Which of the following operations can be performed by MERGE statement in SQL Server 2008?
- WHEN MATCHED
- WHEN NOT MATCHED BY TARGET
- WHEN NOT MATCHED BY SOURCE
Merge is used to check if values match in both Source and Target, which is equal to WHEN MATCHED and an UPDATE is fired. When value exist in SOURCE table but not in TARGET table then WHEN NOT MATCHED [ BY TARGET ] then INSERT the new value and if the value exist in TARGET and not in SOURCE then WHEN NOT MATCHED [BY SOURCE] and DELETE is fired.
Note: The Question is taken from SQLServercentral.com.