use tempdb gocreate table t1(id int identity(1,1),name char(1)) create table t2(id int identity(1,1),name char(1)) insert t1 select 'a' union all select 'b' union all select 'c'delete from t1 where id = 2set identity_insert t2 on goinsert t2(id ,name) select id,name from t1set identity_insert t2 off goselect * from t2 godrop table t1 drop table t2
set identity_insert tablename on set identity_insert tablename off --不知道楼主要达到什么目的 --自增列不连续也没关系,需要的时候可以重新生成一列保持连续
insert into A_TEMP(a,b,c,d,e,f...) select top 10000 aa,bb,cc,dd,ee,ff,.... from A; 这样 行不?
use tempdb
gocreate table t1(id int identity(1,1),name char(1))
create table t2(id int identity(1,1),name char(1))
insert t1 select 'a'
union all select 'b'
union all select 'c'delete from t1 where id = 2set identity_insert t2 on
goinsert t2(id ,name) select id,name from t1set identity_insert t2 off
goselect * from t2
godrop table t1
drop table t2
set identity_insert tablename off
--不知道楼主要达到什么目的
--自增列不连续也没关系,需要的时候可以重新生成一列保持连续
这样 行不?