ITeye博客

sqlserver 实用的功能 upsert

onlyor · 2012-04-06 14:45 · sqlserver · 数据库 · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。