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
 How to change the number format

Author  Topic 

kvishnuprasad
Starting Member

13 Posts

Posted - 2008-06-25 : 12:21:19
I have a table with a column name RequestId which is a character and length of 15.
I have loaded 40000 records into it adn i can see them in the following format

RequestID
1
2
23
64
465 ...etc

Now i need to convert the request id in the following way.

RequestID
000000000000001
000000000000002
000000000000023
000000000000064
000000000000465

ALL i want to do is append zeros infront of the number (15digits)

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-06-25 : 12:25:41
Hi,
try this and make it fitting to your problem:
select right('000000000000000'+RequestID,15)

Greetings
Webfred
Go to Top of Page

kvishnuprasad
Starting Member

13 Posts

Posted - 2008-06-25 : 13:03:26
Thank you fred that works !!!!!!! you are my savior!!!!!!!!!!!!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-25 : 13:06:07
quote:
Originally posted by kvishnuprasad

Thank you fred that works !!!!!!! you are my savior!!!!!!!!!!!!


Note that if you want to show formatted data in front end application, do formation there

Madhivanan

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

- Advertisement -