merge T2 --目标表
using T1 --源表date
on T1.id=T2.id --匹配条件
when matched then --匹配
update set [name]=T1.[name]
when not matched then --不匹配
insert values(id,[name]);
-------------------------------------------------------------------
PS:做库存对比的时候使用