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
时间: 2024-10-02 02:50:55