Home Forums SQL Server 2005 Development string formatting RE: string formatting
Ken Simmons
SSCertifiable
Points: 7822
More actions
October 30, 2008 at 8:47 am
#891858
I don't know of a function in SQL that will format a number that way. I generally do something like this.
Declare @i int
Set @i = 23
Select Right('0000' + Cast(@i as varchar(4)),4)