The MERGE statement
was introduced in SQL Server 2008 as a way to allow us to both insert
new rows and update or delete existing ones, in a single command. The
following simple example should demonstrate how it works, for those
unfamiliar with it. First, we need a table and some test data.
The MERGE command shown in Listing 2 will update the existing article and insert a new one.