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
 General SQL Server Forums
 New to SQL Server Programming
 Changing Identity column format

Author  Topic 

cybersurfer
Starting Member

4 Posts

Posted - 2007-03-19 : 10:28:21
Hi,

Is it possible to change the format of the identity column? i.e. I have and integer value that will be the ID for the records to follow in the database. Instead of the values being 1,2,3,4,5,6,7,8,9 etc I want them still to be in sequence but I want the format to be 001,002,003,004,005,006,007,008,009 etc.

Is it possible to do that in SQL when you're creating the table?

nr
SQLTeam MVY

12543 Posts

Posted - 2007-03-19 : 10:36:25
Identities have to be numeric.
It is trivial to reformat when you retrieve the data and that is the best place to do it (with a view or computed column if you wish).

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -