时间:2021-07-01 10:21:17 帮助过:14人阅读
SELECT FK.NAME,FK.OBJECT_ID,OBJECT_NAME(FK.PARENT_OBJECT_ID) AS REFERENCETABLENAME
FROM SYS.FOREIGN_KEYS AS FK
JOIN SYS.OBJECTS AS O ON FK.REFERENCED_OBJECT_ID=O.OBJECT_ID
WHERE O.NAME = ‘Foreign_Key_Name‘
ALTER TABLE TableName DROP CONSTRAINT FK_Name
SQLServer外键查询删除信息
标签:sys parent where 信息 tab const cts ref object