Disable a Foreign Key Constraint with INSERT and UPDATE Statements

Select the option to disable a foreign key constraint during INSERT and UPDATE transactions if you know that new data will violate the constraint or if the constraint applies only to the data already in the database.

  1. In the Database window, click Database Diagrams   under Objects, click the database diagram you want to open, and then click Design on the Database window toolbar.
  2. In your database diagram, right-click the table containing the foreign key, then select Relationships from the shortcut menu.
  3. Select the relationship from the Selected relationship list.
  4. Clear the Enforce relationship for INSERTs and UPDATEs check box.

After you add or modify data, you should select this option if you want to ensure the constraint applies to subsequent data modifications.

Note   If you plan to use triggers to implement database operations, you must disable foreign key constraints in order for the trigger to run.