Tuesday, April 23, 2013

How to Add Identity to Existing Column

How to Add Identity to Existing Column

 

You can not add Identity to an existing column,

you can drop the column using

alter table [tablename] drop column [columnname]  

add new column with Identity

alter table [tablename] add col int identity(1,1)

for ex:

alter table [dbo].[person] add IDD int identity(1,1);


Tags: How to Add Identity to Existing Column,Alter table ,drop column in sql server,add new column with identity,add  new column to a table using alter table command.

No comments:

Post a Comment