Created
January 24, 2019 20:56
-
-
Save jetstreamin/77637badfa25106c12b3d2aaaa285b96 to your computer and use it in GitHub Desktop.
SQL - Drop Foreign Keys From Table
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 characters
IF EXISTS (SELECT * | |
FROM sys.foreign_keys | |
WHERE object_id = OBJECT_ID(N'dbo.FK_TableName_TableName2') | |
AND parent_object_id = OBJECT_ID(N'dbo.TableName') | |
) | |
ALTER TABLE [dbo.TableName] DROP CONSTRAINT [FK_TableName_TableName2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment