Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem convert 1 to 0001

Author  Topic 

wilang
Starting Member

12 Posts

Posted - 2009-07-29 : 03:45:59
hi all,
i am newbie in query languange.

i have found difficult when i want to convert some number to string format.
example: 1 to 0001,
90 to 0090
in vb.net ,i am using syntaks format(number,'0000') but in sql server i still don't know.
any one have a clue for me??


W

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-29 : 03:47:07
right('0000' + convert(varchar(10), col), 4)


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

wilang
Starting Member

12 Posts

Posted - 2009-07-29 : 03:57:40
Thx Khtan, it's works.
you are my savior. hehe3x

W
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-29 : 05:08:25
If you want to show formatted numbers in front end application, do formation there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -