`
onlyor
  • 浏览: 370744 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

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时则更新

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics