Developers select and use the option to disable a foreign key constraint during INSERT and UPDATE transactions if they know that new data will violate the constraint or if the constraint applies only to the data already in the database. Developer can disable a foreign key constraint for INSERT and UPDATE statements, by following the next steps:
1. In Object Explorer, right-click the table with the constraint, and click Design (Modify in SP1 or earlier).
The table opens in Table Designer.
2. From the Table Designer menu, click Relationships.
3. In the Foreign Key Relationships dialog box, select the relationship in the Selected Relationship list.
4. In the grid, click Delete Rule or Update Rule and choose an action from the drop-down list box to the left of the property.
– No Action An error message tells the user that the deletion is not allowed and the DELETE is rolled back.
– Cascade Deletes all rows containing data involved in the foreign key relationship.
– Set Null Sets the value to null if all foreign key columns for the table can accept null values. Applies to SQL Server 2005 only.
– Set Default Sets the value to the default value defined for the column if all foreign key columns for the table have defaults defined for them. Applies to SQL Server 2005 only.