The MERGE
statement (introduced in SQL Server 2008) allows us to perform a mixture of INSERT
, UPDATE
, and DELETE
operations using a single declarative statement. The Halloween Protection issues for MERGE
are, logically enough, mostly a combination of the requirements for the individual operations performed, but there are some important differences and a couple of optimizations that apply only to MERGE
.