Created
May 18, 2018 15:17
-
-
Save nkigen/b562a834194012d68c152ce17b96a60f to your computer and use it in GitHub Desktop.
Revisions
-
nkigen created this gist
May 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ DECLARE @SQL NVARCHAR(MAX) = N''; SELECT @SQL += N' ALTER TABLE ' + OBJECT_NAME(PARENT_OBJECT_ID) + ' DROP CONSTRAINT ' + OBJECT_NAME(OBJECT_ID) + ';' FROM SYS.OBJECTS WHERE TYPE_DESC LIKE '%CONSTRAINT' AND OBJECT_NAME(PARENT_OBJECT_ID) = 'Your_TABLE'; PRINT @SQL