I need to change the primary key of a table to an identity column, and there\'s already a number of rows in table.
I\'ve got a script to clean up the IDs to ensure
I don't believe you can alter an existing column to be an identity column using tsql. However, you can do it through the Enterprise Manager design view.
Alternatively you could create a new row as the identity column, drop the old column, then rename your new column.
ALTER TABLE FooTable
ADD BarColumn INT IDENTITY(1, 1)
NOT NULL
PRIMARY KEY CLUSTERED