Javatpoint Logo
Javatpoint Logo

Disable Foreign Key

ALTER TABLE statement is used to disable a foreign key. Once you have created a foreign key in SQL Server, you may get a situation where you are want to disable the foreign key, use the following syntax.

Syntax:

Parameter explanation

table_name: It specifies the name of the table where the foreign key has been created.

fk_name: It specifies the name of the foreign key that you wish to disable.

Example:

Create a foreign key by creating two tables "products3" and "inventory" table.

Now use the following command to disable the foreign key where foreign constraint is:

fk_inv_product_id.

Output:

SQL Disable 1

Now the foreign key is disabled.


Next TopicDrop Foreign Key




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA