sql-server – INSERT语句与FOREIGN KEY约束冲突
发布时间:2020-12-12 16:47:37 所属栏目:MsSql教程 来源:网络整理
导读:Error: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint “FK__Item__order__3AE27131”. The conflict occurred in database “pmall”,table “dbo.ItemSaved”,column ‘id’. 这是我的表: ItemS
这是我的表: ItemSavedUnits > id 这是我的insert语句: insert into ItemSavedUnits (ItemID,name,Price) select ItemID,Price from ItemUnits where ItemID = 92439 我真的不明白为什么如果我对ItemStoreUnits.ItemID的FK约束与Item.ItemID和ItemUnits有关,就没有任何限制,为什么我在插入到ItemSavedUnits中有问题. ItemID我试图插入确实存在于Item表中. 解决方法您是否确定ItemId 92439存在于Item表中,而不仅仅在ItemUnits中?要么 你的select语句是否返回null? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读