Monday, December 26, 2011

Convert number to text with fixed number of characters

If you have a field contains numbers and you want to read it as text with a fixed number of characters, for example: 1 to be 01 and 13 to keep it 13, you can do something like:

select right ('00'+ltrim(str(field)),2 )



No comments:

Post a Comment