Sql 合并冲突外键约束
我使用Sql 合并冲突外键约束,sql,sql-server,merge,foreign-keys,constraints,Sql,Sql Server,Merge,Foreign Keys,Constraints,我使用合并来更新或将数据插入我的数据库。但是当我将合并到我的表xx_MaterialData或xx_MaterialDataxxx中时,我得到FK错误,如下所示 The MERGE statement conflicted with the FOREIGN KEY constraint "FK_xx_MaterialData_xxxx_Material". The conflict occurred in database "TEST", table
合并
来更新
或将
数据插入我的数据库。但是当我将合并到我的表xx_MaterialData
或xx_MaterialDataxxx
中时,我得到FK错误,如下所示
The MERGE statement conflicted with the FOREIGN KEY constraint
"FK_xx_MaterialData_xxxx_Material". The conflict occurred in database
"TEST", table "dbo.xxxx_Material", column 'xxxxxGUID'.
及
我已经尝试了不同顺序的MERGE
语句,但并没有帮助。我先尝试了xxxx_材料,然后是孩子们。或者首先是子项xx\u MaterialData xxx
,然后是xx\u MaterialData
,然后是xxxx\u Material
依赖项包括:
xxxx\u物料
xx\u物料数据
xx\u物料数据
xxxx\u物料
xxxx\u物料文本
xxxx\u价格表
xx\u材料数据XXX
有人知道我还能做什么吗?我有另一个数据库,具有相同的结构,但数据不同,在那里我没有问题
MERGE
语句的正确顺序是什么?也许我做错了什么?显然,陈述的顺序仍然有问题。按正确的顺序重新放置后,它就工作了。您能提供您的查询和表结构吗?请在更新、插入或删除任何内容之前运行SELECT进行验证。谢谢。可能有两份
The MERGE statement conflicted with the FOREIGN KEY constraint
"FK_xx_MaterialDataxxx_xxxx_MaterialText". The conflict occurred in
database "TEST", table "dbo.xx_MaterialData", column 'xxxxxGUID'.