MERGE

Using the MERGE Statement to Perform an UPSERT

  • Article

The term UPSERT has been coined to refer to an operation that inserts rows into a table if they don’t exist, otherwise they are updated. To perform the UPSERT operation Microsoft introduced the MERGE statement. Not only does the MERGE statement support the UPSERT concept, but it also supports deleting records. Greg Larsen discusses how to use the MERGE statement to UPDATE, INSERT and DELETE records from a target table.

2014-12-22

13,060 reads

Blogs

ACM Lecture at SELU

By

Had the pleasure of presenting to Dr. Ghassan Alkadi and a full house at...

T-SQL Copy & Paste Pattern – Increasing a performance problem

By

Disclaimer: The title is my assumption because I saw it in the past happening...

Removing ad hoc plans from Query Store

By

This is not a post about the “optimize for ad hoc workloads” setting on...

Read the latest Blogs

Forums

To show the count per month from the date provided

By VSSGeorge

I have two tables namely Vendors & Visits. Create Table Vendor (VendorId BIGINT IDENTITY(1,1)...

Two tables per page

By Ken at work

I have this report, see below, that works great. Enter the employee number and...

How to find out HOW MANY inserts, HOW MANY updates happend in merge

By mcfarlandparkway

How can i get the counts of how many records updated and how many...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers

Question of the Day

Fashion

See possible answers