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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 String Format

Author  Topic 

erwine
Yak Posting Veteran

69 Posts

Posted - 2006-03-28 : 02:42:25
Hi everybody..

select '0023' + 1

output : 24

but i wanna see '0024'.
is there any SQL-defined function for that?


... sql is fun...

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-28 : 02:50:45
Format the number in your Front End application if any


Madhivanan

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

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-28 : 03:17:55
If you have to do it in T-SQL.
select right('0000' + convert(varchar, '0023' + 1), 4)




KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant

Go to Top of Page
   

- Advertisement -