create table 表名(id int identity(1,1), txt varchar(100)) insert into 表名 select 'aa' insert into 表名 select 'bb' insert into 表名 select 'cc' insert into 表名 select 'dd' select * from 表名delete 表名 where id=4insert into 表名 select 'ee'select * from 表名 --此时若要追加id=4的,如下:set identity_insert 表名 oninsert into 表名(id,txt) select 4,'ttt'set identity_insert 表名 offselect * from 表名 drop table 表名
我找到了用下边的,谢谢各位帮忙GO DBCC CHECKIDENT (Table1, RESEED, 4) GO INSERT INTO TABLE1(B) VALUES('bb') SELECT * FROM TABLE1
set identity_insert 表名 oninsert into 表名(id,txt) select 4,'ttt'set identity_insert 表名 offselect * from 表名
select max(A)+1 from table1来取得@!
insert into 表名 select 'aa'
insert into 表名 select 'bb'
insert into 表名 select 'cc'
insert into 表名 select 'dd'
select * from 表名delete 表名 where id=4insert into 表名 select 'ee'select * from 表名
--此时若要追加id=4的,如下:set identity_insert 表名 oninsert into 表名(id,txt) select 4,'ttt'set identity_insert 表名 offselect * from 表名
drop table 表名
DBCC CHECKIDENT (Table1, RESEED, 4)
GO
INSERT INTO TABLE1(B) VALUES('bb')
SELECT * FROM TABLE1