sqlserver 适用的功能 upsert
sqlserver 实用的功能 upsert
merge into Target using Source
on (condition)
when matched then
update set column1=value1
when not matched then
insert (column1, column2) values (value1, value2);
解释:
Target : 目标表名
Source: 源表名
Condition: 为匹配条件
当matched时更新,not时则更新