/*
报错为
DELETE 语句与 REFERENCE 约束"FK_ProductInfo_Category"冲突。该冲突发生于数据库"eshop",表"dbo.ProductInfo", column 'CategoryId'。DELETE 语句与 REFERENCE 约束"FK_ShoppingCart_ProductInfo"冲突。该冲突发生于数据库"eshop",表"dbo.ShoppingCart", column 'ProductId'。
语句已终止。
语句已终止。
*/
在sql server中写sql语句执行:
alter table ProductInfo
drop CONSTRAINT FK_ProductInfo_Category
alter table ShoppingCart
drop CONSTRAINT FK_ShoppingCart_ProductInfo

本文详细介绍了如何在SQL Server中处理删除表时与引用约束冲突的情况,通过修改约束来避免语句终止,并提供了具体示例。

555

被折叠的 条评论
为什么被折叠?



