Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conveting Number to String to Combine Strings 1

Status
Not open for further replies.

sabloomer

Technical User
Aug 8, 2003
153
US
I have a sql view that returns a number as interger. I need to convert that value to a string that has leading zeros. (Example 1 should be 001)

In Access MDB I would do something like...

Right('000' & CStr([IntField]),3)

...but Cstr is not a valid function in SQL Views.


I can take two existing text fields and combine them with a '+', but when I try to '000' + [IntField] or '000' & [IntField] the whole field is displayed as string.

Can anyone tell me what I am doing wrong or how to make this conversion.

Thanks,

sabloomer
 
Check out the STUFF function in SQL Server help (Books OnLIne).

I have great faith in fools; self-confidence my friends call it.
-Poe
 
STUFF HAPPENS!!!!!

I was able to get ...

RIGHT (STUFF(LineNumber, 1, 0, '000'), 3)

to work.

Thanks for the suggestion!

sabloomer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top