2009年11月2日 星期一

SQL Server 2008 -- The MERGE Statement (1)


The MERGE statement is a combination statement that can perform INSERT, UPDATE, and DELETE statements based on whether rows that match the selection criteria exist in the target table or not.
This new statement has a flexible syntax that allows us to exercise fine control over source and target matching, as well as the various set-based DML actions carried out on the target. The result is simpler code that's easier to write and maintain (and also runs faster) than the equivalent code using separate statements to achieve the same result.
The MERGE statement is particularly suited to data warehousing scenarios.
The terminating semicolon[分號] (part of the SQL standard) is rarely necessary in SQL Server.

沒有留言:

張貼留言