■ FK 삭제문을 만드는 방법을 보여준다.
▶ 예제 코드 (SQL)
1 2 3 4 5 6 7 8 9 10 |
SELECT DISTINCT 'ALTER TABLE ' + '[' + OBJECT_NAME(FK.parent_object_id) + ']' + 'DROP CONSTRAINT ' + '[' + FK.name + ']' FROM sys.foreign_keys AS FK INNER JOIN sys.foreign_key_columns AS FC ON FK.[object_id] = FC.constraint_object_id WHERE FK.[schema_id] = 1; |