Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

sql query1 Expand / Collapse
Author
Message
Posted Wednesday, January 9, 2013 1:42 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:52 AM
Points: 210, Visits: 4,520
hi friens i have small doubt in sql server.plese tell me how to solve this issuse.

table data contains like
id
10
12
9
15
8
4
100
29
i want output like
id
010
012
009
015
008
004
100
029
.plese tell me how to write query in sql server
Post #1404599
Posted Wednesday, January 9, 2013 1:49 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 18, 2014 9:09 AM
Points: 870, Visits: 2,385
This should work, there are other ways as well

CREATE TABLE #Id
(
Id int
)

Insert into #Id
Values (10),(12),(9),(15),(8),(4),(100),(29)


Select Id,Right('000'+Convert(varchar,Id),3) from #Id




_________________________________________________________________________
SSC Guide to Posting and Best Practices
Post #1404601
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse