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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA