Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error is reported during batch update: "The MERGE statement attempted to update or delete the same row multiple times. This situation occurs when the target row matches multiple source rows." #1644

Open
LadyKiller1025 opened this issue Dec 18, 2024 · 2 comments

Comments

@LadyKiller1025
Copy link

调用BulkUpdateAsync方法时提示"MERGE 语句试图多次更新或删除同一行。目标行与多个源行匹配时会出现这种情况"错误,查了下说是当使用 MERGE 语句时,出现此错误是因为 ON 子句的条件使得目标表中的某一行与源表中的多行相匹配,而 MERGE 语句不允许对目标表的同一行进行多次更新或删除操作。 但是我不知道这个on条件是什么,以及如何排查源表中哪些匹配出了多行,有大佬知道吗?

@borisdj
Copy link
Owner

borisdj commented Dec 19, 2024

Hi, Can you use Translate and update this into English.

@LadyKiller1025
Copy link
Author

Hi, Can you use Translate and update this into English.

When the BulkUpdateAsync method is called, an error message "The MERGE statement attempted to update or delete the same row multiple times. This situation occurs when the target row matches multiple source rows" is prompted. After checking, it is said that when using the MERGE statement, this error occurs because the conditions in the ON clause make a certain row in the target table match multiple rows in the source table, and the MERGE statement does not allow multiple updates or deletions on the same row of the target table. However, I don't know what this ON condition is and how to check which matches in the source table result in multiple rows.

@LadyKiller1025 LadyKiller1025 changed the title 批量更新报错“MERGE 语句试图多次更新或删除同一行。目标行与多个源行匹配时会出现这种情况 ”? An error is reported during batch update: "The MERGE statement attempted to update or delete the same row multiple times. This situation occurs when the target row matches multiple source rows." Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants