SQL server 2008 Question:
Download Questions PDF

What is MERGE in sql server 2008?

SQL server 2008 Interview Question
SQL server 2008 Interview Question

Answer:

Merge statement allows a single statement for INSERT, DELETE and UPDATE a row that depends on a condition. The target table for certain operations is based on the results of join with a source table. The following example illustrates the use of MERGE.

MERGE InventoryMaster AS invmstr
USING (SELECT InventoryID, Descr FROM NewInventory) AS src
ON invmstr. InventoryID = src. InventoryID
WHEN MATCHED THEN
UPDATE SET invmstr.Descr = src.Descr
WHEN NOT MATCHED THEN

INSERT (InventoryID, Descr) VALUES (src. InventoryID, src.Descr);.

Download SQL server 2008 Interview Questions And Answers PDF

Previous QuestionNext Question
What are spatial data types - geometry and geography in sql server 2008?What is Change Data Capture (CDC) feature in sql server 2008?