--drop table test
create table test(id int not null,value int)
insert test select 1,2
union all select 2,3
union all select 3,4
go
--方法如下
--建个表结构一样的表 注意ID属性为自增
CREATE TABLE test_tmp(ID int IDENTITY,value int)
--将test表的内容copy到过渡表来
SET IDENTITY_INSERT test_tmp ON
INSERT test_tmp(ID,value ) SELECT * FROM test
SET IDENTITY_INSERT test_tmp OFF
--删除test
DROP TABLE Test
GO
--将过渡表名字改成test
EXEC sp_rename N'test_tmp',N'test'
INSERT test select 4
GO
select * from test
/*
ID value
----------- -----------
1 2
2 3
3 4
4 4*/