I've created a table but want to add an identity column to it.
How is this done through the management studio? (SQL Server 2008)
(The Identity specification is disabled and set to No for all columns).
Cheers
Microsoft SQL ServerMicrosoft SQL Server 2008Microsoft Server Apps
Last Comment
Guy Hengel [angelIII / a3]
8/22/2022 - Mon
sammySeltzer
ALTER TABLE YourTable ALTER COLUMN Id IDENTITY (200,1)
sammySeltzer
above assumes that the colum already exists.
If that isn't the case, then this will add a column and make it identity seed:
alter table yourTable
add id int not null Identity(1,1)
If the column you want to use already has data in it you will not be able to use it as an Identity column, you will need to create a new column, and it will have to be an int column and it may not allow nulls.