Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add the IDENTITY property to existing SQL Azure table?

I have created a couple of tables in SQL Azure and forgot to mark the primary keys as identity columns. There is no data in the tables yet, but the check box marked Is Identity is disabled.

How do I make an existing primary key an identity column in SQL Azure?

like image 474
Feckmore Avatar asked Jan 24 '26 15:01

Feckmore


1 Answers

You create a new table. You can't change the IDENTITY property in a regular SQL Server instance either - well, depending on your settings, SSMS might let you, but it doesn't tell you what it actually does behind the scenes - drops the table and re-creates it. Don't believe me? Script it out or profile it.

like image 53
Aaron Bertrand Avatar answered Jan 26 '26 13:01

Aaron Bertrand