Wednesday, November 28, 2012

upsert and merge

I heard the term upsert today and it is synonymous with merge per Wikipedia which is never wrong.

MERGE INTO TABLE_NAME USING table_reference ON (condition)
   WHEN MATCHED THEN
   UPDATE SET column1 = value1 [, column2 = value2 ...]
   WHEN NOT MATCHED THEN
   INSERT (column1 [, column2 ...]) VALUES (value1 [, value2 ...

Addendum 1/16/2015: This is really stupid. Please see this instead.

No comments:

Post a Comment