1. MERGE用法:关联两表,有则改,无则加 SQL语句: create table #AAA(id int,A int,AA int,AAA int,B int) create table #BBB(A int,B int) ,,,,,,,,,,,,,,,,null , , , , merge into #AAA as t using ( )as s on s.A=t.A when matched then update set t.B=s.B ,s.A,,,s.B) output $act