Delete Foreign Key Relationships

APPLIES TO: yesSQL Server yesAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

You can delete a foreign key constraint in SQL Server 2017 by using SQL Server Management Studio or Transact-SQL. Deleting a foreign key constraint removes the requirement to enforce referential integrity.

In This Topic

Before You Begin

Security

Permissions

Requires ALTER permission on the table.

Using SQL Server Management Studio

To delete a foreign key constraint

  1. In Object Explorer, expand the table with the constraint and then expand Keys.

  2. Right-click the constraint and then click Delete.

  3. In the Delete Object dialog box, click OK.

We are listening: If you find something outdated or incorrect in this article, such as a step or a code example, please tell us. You can click the This page button in the Feedback section at the bottom of this page. We read every item of feedback about SQL, typically the next day. Thanks.

Using Transact-SQL

To delete a foreign key constraint

  1. In Object Explorer, connect to an instance of Database Engine.

  2. On the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute.

    USE AdventureWorks2012;  
    GO  
    ALTER TABLE dbo.DocExe   
    DROP CONSTRAINT FK_Column_B;   
    GO  
    

For more information, see ALTER TABLE (Transact-SQL).