SQL Server: Drop all Foreign Keys that Reference a Table


Before you drop a table in SQL Server, you must first drop all the foreign keys that reference that table. The following SQL scripts may help with this task.

Step 1:  Run the following to create a Stored Procedure that will perform the drop:

Step 2: Run the following to drop all FKs that reference the target table:

Step 3: Run the following to delete the Stored Procedure that was created in step 1:

Leave a Reply

Your email address will not be published. Required fields are marked *