Disabling a Foreign Key Constraint with INSERT and UPDATE Statements

Visual Database Tools

Visual Database Tools

Disabling 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.

To disable a foreign key constraint for INSERT and UPDATE statements

  1. In your database diagram, right-click the table containing the foreign key, then select Properties from the shortcut menu.

    -or-

    Open the Table Designer for the table containing the foreign key you want to modify, right-click in the Table Designer, and choose Properties from the shortcut menu.

  2. Choose the Relationships tab.

  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.

See Also

Constraints | Foreign Key Constraints