3

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?

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
Feckmore
  • 4,322
  • 6
  • 43
  • 51

1 Answers1

5

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.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
  • Very interesting; I always disable the SSMS warnings about dropping tables and never realized when it might have to do that in the background. – Jedidja Feb 20 '13 at 00:19