What is the behavior when merge key is not unique
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 12:02 AM
Hi,
When using the MERGE statement, if merge key is not unique on both source and target, it will throw error. If merge key is unique in source but not unique in target, WHEN MATCHED THEN DELETE/UPDATE should work or not? For example merge key is id. Src has 1 row id = 1, target has multiple rows with id = 1. WHEN MATCHED will update or delete all rows in target for id = 1 or pick up 1 randomly?
Thanks
Brad