Hi
How do I set the Identity property to a column in an existing table through Transact-SQL?
Thanking you in advance
PORRASTAR
Printable View
Hi
How do I set the Identity property to a column in an existing table through Transact-SQL?
Thanking you in advance
PORRASTAR
Not sure that you can set an existing column to an IDENTITY. You can add a new identity column like this:
Or the brute-force way to do it would be to create a temporary table with your data, DROP the table, recreate it with the IDENTITY column and repopulate it from your temp table...Code:ALTER TABLE myTable
ADD newIDColumn int IDENTITY(1,1)