SQLServer MERGE INTO
作者:
DH东海 | 来源:发表于
2019-03-25 13:58 被阅读0次MERGE INTO @TargetTable AS T
USING @SourceTable AS S
ON T.ID = S.ID
WHEN MATCHED
THEN UPDATE SET T.DSPT = S.DSPT
WHEN NOT MATCHED BY TARGET
THEN INSERT VALUES(S.ID,S.DSPT)
WHEN NOT MATCHED BY SOURCE
THEN DELETE
OUTPUT $ACTION AS [ACTION],
Deleted.ID AS 'Deleted ID',
Deleted.DSPT AS 'Deleted Description',
Inserted.ID AS 'Inserted ID',
Inserted.DSPT AS 'Inserted Description'
INTO @Log;
本文标题:SQLServer MERGE INTO
本文链接:https://www.haomeiwen.com/subject/libvvqtx.html
网友评论