insert A select * from B where DWDM not in (select DWDM from A)
--maybe update a set dwdm=b.dwdm from tablea a join tableb b on charindex(a.dwdm,b.dwdm)=1
delete A where DWDM not in (select DWDM from B)
TRUNCATE table A insert A select * from B 也可以..`
insert A select * from B where DWDM not in (select DWDM from A)
insert into A select * from B where DWDM not in (select DWDM from A)
create table A(DWDM int) insert A select 12 union all select 10 union all select 45 union all select 20 go create table B(DWDM int) insert B select 12 union all select 10 union all select 45 union all select 20 union all select 23 union all select 25 goinsert A select DWDM from B as tmp where not exists(select 1 from A where DWDM=tmp.DWDM)select * from A
select * from B where DWDM not in (select DWDM from A)
update a set dwdm=b.dwdm from tablea a join tableb b on charindex(a.dwdm,b.dwdm)=1
where DWDM not in (select DWDM from B)
insert A select * from B
也可以..`
select * from B where DWDM not in (select DWDM from A)
select * from B where DWDM not in (select DWDM from A)
insert A select 12
union all select 10
union all select 45
union all select 20
go
create table B(DWDM int)
insert B select 12
union all select 10
union all select 45
union all select 20
union all select 23
union all select 25
goinsert A
select DWDM from B as tmp
where not exists(select 1 from A where DWDM=tmp.DWDM)select * from A