SQL: Add an Identity Column to an Existing Database Table

4/21/2015 3:40:32 PM

SQL

The following will add a new identity column "Id" to an existing table "Users". It will be a non-nullable, identity column, with the unique values filled in.

ALTER TABLE Users
ADD Id INT IDENTITY(1,1)