--用checksum,例子参见如下:/*
表A
两个字段x,y
内容如下
1,2
1,4
2,8
8,9表B
两个字段x,y
内容如下
1,2
8,9用一个语句删除表表A中与表B重复的记录。
*/create table #A(x int,y int)
go
insert into #A(x,y)
select 1,2 union all
select 1,4 union all
select 2,8 union all
select 8,9create table #B(x int,y int)
go
insert into #B(x,y)
select 1,2 union all
select 8,9select * from #A
select * from #B--用checksum
delete #A where checksum(*) in (select checksum(*) from #B)select * from #A
select * from #Bdrop table #A,#B
go