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
 How to disable and re-enable the identity column

Author  Topic 

mavericky
Posting Yak Master

117 Posts

Posted - 2011-11-01 : 18:58:28
Hi,
Can anyone tell me how to disable and re-enable the identity property of a column?

Thanks,
Mavericky

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-11-01 : 20:34:28
You can't. It can only be included when you create the column, you'd have to drop the column to remove the identity property from it.
Go to Top of Page

uberman
Posting Yak Master

159 Posts

Posted - 2011-11-02 : 04:39:44
However, if you just want to insert specific values into an existing identity column this can be done; http://msdn.microsoft.com/en-us/library/ms188059.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-02 : 05:04:17
see

http://www.mssqltips.com/sqlservertip/1397/add-or-drop-identity-property-for-an-existing-sql-server-column/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-02 : 05:06:26
also make a note that once the IDENTITY_INSERT is ON it should be set to OFF after population step. Since only one table at a time can have it set unless you make it OFF you cant enable it for another table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -