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 2005 Forums
 Transact-SQL (2005)
 Formatting strings

Author  Topic 

cidmi.dovic
Yak Posting Veteran

53 Posts

Posted - 2007-03-14 : 03:03:02
Hi, a simple question:

How can I format numeric values to strings?
I mean,

I want to add 0 in the left, fo example:
Year : 2007
Month : 3 -> 03
Day : 1 -> 01

I take a look in the documentation I've found the FORMAT_STRING cell property but not how to use it.

Thanks.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-14 : 03:05:43
[code]
select right('00' + convert(varchar(10), numeric_col), 2)
[/code]


KH

Go to Top of Page
   

- Advertisement -