22,209
社区成员
发帖
与我相关
我的任务
分享
insert into 表([字段列表])
select [字段列表]
from [临时表] a
where not exists(select 1
from 表 b
where b.A1=a.A1 AND b.A2=a.A2)
-- 凑个人数
drop table test
go
create table test (A1 int , A2 int )
go
insert into test(A1 , A2) values(1,2),(3,4)
go
insert into test(A1 , A2)
select 5 ,6
except
select A1 , A2 from test where A1 =5 and A2 = 6
go 2 -- 执行 2 次
select * from test
go
(2 行受影响)
开始执行循环
(1 行受影响)
(0 行受影响)
批处理执行已完成 2 次。
A1 A2
----------- -----------
1 2
3 4
5 6
(3 行受影响)