138
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:
Now the foreign key is disabled.
Next TopicDrop Foreign Key