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
 data convertion

Author  Topic 

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-05-15 : 04:23:12
Hi guys,

need your help.

what can I do to convert the ff:

00001250 to 000001250

what syntax should I use?

tnx

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-05-15 : 04:29:04
If you always want it to be 9 characters, then:

select right('000000000' + '00001250', 9)
Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-05-15 : 06:02:51
thanks alot!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-05-17 : 09:03:51
Another method

select replace(str('00001250',9),' ','0')


However consider doing the formation at the front end application

Madhivanan

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

- Advertisement -