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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Identity column question

Author  Topic 

BruceT
Yak Posting Veteran

78 Posts

Posted - 2011-12-27 : 12:17:43
Hi all,

Is there a way to remove the identity property from a column and add it back later? I have a "stupid" situation. I need to insert data into a table from a 3rd party app. The PK is an identity column, the 3rd party app is internally setting Identity insert off so I can't set it on before hand because the app resets it to off so when it inserts it throws the can't insert into an identity column error. (I said it was stupid!) So I need to drop the identity constraint, run the app, then add the identity constraint back onto the column.

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-27 : 12:43:18
no direct way to alter identity property
workaround is this
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

BruceT
Yak Posting Veteran

78 Posts

Posted - 2011-12-27 : 13:26:56
quote:
Originally posted by visakh16

no direct way to alter identity property
workaround is this
http://www.mssqltips.com/sqlservertip/1397/add-or-drop-identity-property-for-an-existing-sql-server-column/



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





Thanks visakh16. That's the path I was headed down, I was just hoping there was an easier way.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-27 : 14:00:17
np
you're wc

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

Go to Top of Page
   

- Advertisement -