u have 2 options,
1. Create a new table with identity & drop the existing table
2. Create a new column with identity & drop the existing column
Create table testtable(id int,name varchar(10))insert into testtable values(1,'AAAAAA')
insert into testtable values(2,'BBBBB')
go
select * from testtable
go
Alter Table testtable Add Id_new Int Identity(1,1)
Go
Alter Table testtable Drop Column ID
Go
Exec sp_rename 'testtable.Id_new', 'ID','Column'
insert into testtable values('CCCC')
select * from testtable
================================================
connect to your db
show the table/column names in object explorer window
right click on column name
select modify
in column properties tab
alter "identity specification"/"is identity" to YES
set increment/seed properties as desired
No comments:
Post a Comment