O'Reilly logo

Inside Microsoft® SQL Server® 2008: T-SQL Querying by Lubor Kollar Itzik Ben-Gan Dejan Sarka, and Steve Kass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Merging Data

SQL Server 2008 introduces support for the MERGE statement. This statement allows you to identify a source and a target table and modify the target with data from the source, applying different modification actions (INSERT, UPDATE, DELETE) based on conditional logic. SQL Server implements the standard MERGE statement with a couple of extensions that are not part of the standard.

The MERGE statement has many uses both in OLTP and in data warehouse environments. For example, in an OLTP environment you can use it to merge data you get from an external source into an existing target table. In a data warehouse environment you can use it to apply incremental updates to aggregated data, process slowly changing dimensions, and so on.

In the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required