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

Is Format Functions Avail in SQl Server? Expand / Collapse
Author
Message
Posted Tuesday, January 25, 2011 7:32 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, December 8, 2014 4:27 AM
Points: 284, Visits: 1,249
Dear All,

I have to create the auto Generation Number in sql like Identity but
The Problem is

The Data like the below format
00001
00002
.
.
.
.
00010
00011
00012 Etc
Is it possible? I know the INT,NUMERIC, will void the prefix zeros
But is it possible to bring this format in result set?



Many Thanks!
S.saravanan
“I am a slow walker, but I never walk backwards-
Abraham Lincoln”
Post #1053137
Posted Tuesday, January 25, 2011 7:39 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 11:15 AM
Points: 4,156, Visits: 5,551
You could try:
RIGHT('0000'+CONVERT(VARCHAR(5),ColumnName),5)



____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1053143
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse