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
 Database Design and Application Architecture
 identity column

Author  Topic 

vb03
Starting Member

1 Post

Posted - 2007-03-26 : 08:04:01
Is it possible to change a non identity column to identity column without dropping the column using query analyser?

Any one can help me regarding this issue?

nr
SQLTeam MVY

12543 Posts

Posted - 2007-03-26 : 08:57:26
Well you can use management studio but it will do the same thing.
It's not possible to add an identity property to an existing column.

==========================================
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

spejbl
Starting Member

28 Posts

Posted - 2007-03-26 : 09:01:32
You cannot use ALTER TABLE to change a column into IDENTITY column. One way is to rename the table, create
a new and move over the data. You need to have SET IDENTITY_INSERT on for the table when you move the data.

You can also do it in Enterprise Mangager (Management Studio) - which will renamed and move data behind the scenes.

kb
http://kbupdate.info/ | http://suppline.com/
Go to Top of Page
   

- Advertisement -