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:做庫存對比的時候使用