Online Documentation for SQL Manager for SQL server
Creating/editing foreign key
Use the Foreign Key tab of Foreign Key Editor to create/edit a foreign key constraint and specify its properties.
Name
Enter a name for the new foreign key, or modify the name of the foreign key being edited.
Table
The drop-down list of tables allows you to select the table for which the foreign key is created.
The Table Columns area allows you to select Foreign key column(s).
To select a column, you need to move it from the Available Columns list to the Included Columns list. Use the buttons or drag-and-drop operations to move the columns from one list to another.
Foreign table
Use the drop-down list to select the foreign table.
The Foreign Table Columns area allows you to select the column(s) of the Foreign table.
To select a column, you need to move it from the Available Columns list to the Included Columns list. Use the buttons or drag-and-drop operations to move the columns from one list to another.
If the referenced column(s) are changed frequently, it may be wise to add an index to the foreign key column so that referential actions associated with the foreign key column were performed more efficiently. See Indexes for details.
Update action / Delete action
- No action
Produce an error indicating that the deletion or update would create a foreign key constraint violation. If the constraint is deferred, this error will be produced at constraint check time if there still exist any referencing rows. This is the default action.
- Cascade
Delete any rows referencing the deleted row, or update the value of the referencing column to the new value of the referenced column, respectively.
- Set NULL
Set the referencing column(s) to null.
- Set default
Set the referencing column(s) to their default values.
Enabled
Enables/disables the foreign key immediately after it is created.
Check existing data
This option specifies whether the data in the table is or is not validated against a newly added or re-enabled foreign key.
Not for replication
This option allows you to specify that the foreign key should not be enabled when a replication agent modifies the table that is involved in the foreign key.