Cannot Create Identity Key by Altering a Column with Primary Key
Posted on 2011-03-03
I have a table created with primary key not null and it has data in it.
Later on i realized the primary key column should be identity (1,1).
I have to do it using the scripts not going to the design view.
ALTER TABLE XYZ
ALTER COLUMN [ID] [int] IDENTITY(1,1) NOT NULL;
i get the following error, any help will be appreciated.
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'IDENTITY'.