SQL Server add auto increment primary key to existing table
No – you have to do it the other way around: add it right from the get go as INT IDENTITY – it will be filled with identity values when you do this: ALTER TABLE dbo.YourTable ADD ID INT IDENTITY and then you can make it the primary key: ALTER TABLE dbo.YourTable ADD CONSTRAINT PK_YourTable … Read more