Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to change Identity Specification to Yes in Sql Server table

Tags:

sql-server

This may be a dumb question, but why can't I change the Identity Specification or (Is Identity) from 'No' to 'Yes'?

like image 614
malckier Avatar asked Dec 15 '10 04:12

malckier


People also ask

Why I Cannot change the identity specification in SQL Server?

You cannot change the IDENTITY property of a column on an existing table. What you can do is add a new column with the IDENTITY property, delete the old column, and rename the new column with the old columns name.

Can not update identity column in SQL Server?

You can not update identity column.SQL Server does not allow to update the identity column unlike what you can do with other columns with an update statement. Although there are some alternatives to achieve a similar kind of requirement.


1 Answers

Check your column data type.

If it is varchar then you can't change identity column.

To change identity column, it should have int data type.

like image 69
kedar Avatar answered Sep 18 '22 14:09

kedar