SQL 同步表

begin tran

with bakid as(
    select id from dt_A_bak


select * 
into #dt_A_Exc
from dt_A where id not in (
    select * from bakid



select * 
into #dt_A_Inter
from dt_A where id in (
    select * from bakid


insert into dt_A_bak
select * from #dt_A_Exc

update dt1 set dt1.name = dt2.name
from dt_A_bak dt1
inner join dt_A dt2 on dt1.id = dt2.id
where dt1.id in (
    select id from #dt_A_Inter

select * from dt_A
select * from dt_A_bak

rollback tran

《SQL 同步表,没有添加,有就更新》 常伟华 创作。
本作品采用知识共享署名-相同方式共享 4.0 国际许可协议 | 3.0 中国大陆许可协议进行许可。


A PHP Error was encountered

Severity: Core Warning

Message: PHP Startup: zip: Unable to initialize module Module compiled with module API=20060613 PHP compiled with module API=20090626 These options need to match

Filename: Unknown

Line Number: 0