Friday, February 24, 2012

IDENTITY Column

Hi,

I am performing "SET IDENTITY_INSERT ON" on a table which does not have IDENTITY COLUMN. It gives me an error because of that as follows.

Table does not have the identity property. Cannot perform SET operation.

How do i supress the error and proceed.

pls help.
Thank You.The error is self-explanatory. Check this MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro01/html/sql01d4.asp) link.|||you will have to use alter table command to set the column identity and then u can use set command to toggle the values on or off.|||Originally posted by swatisk
Hi,

I am performing "SET IDENTITY_INSERT ON" on a table which does not have IDENTITY COLUMN. It gives me an error because of that as follows.

Table does not have the identity property. Cannot perform SET operation.

How do i supress the error and proceed.

pls help.
Thank You.

The error states that SQL Server does not think there is an identity column on the table. If there truly is then the Index relating to the identity is corrupt. You may be able to fix it with DBCC commands but your best bet is to change the identitiy field to a int, saving it and then changing it back to an identity. Its sort of like jury rigging a table. Microsoft will recommend dropping the table and recreating it.

No comments:

Post a Comment