Foreign Key Constraint

From RAD Studio
Jump to: navigation, search

Go Up to Database Dialog Boxes

Use this dialog box to define a foreign key constraint between tables in a dataset. The table you selected when navigating to this dialog is automatically set to the foreign key table. You could, therefore, attempt to set the master table in a master-detail relationship to be the detail table. This could, at the very least return unpredictable results. If the actual detail, or foreign key, table's foreign key column contains duplicates, you may generate a design-time error.

Item Description

Name

Specify the name of the relation.

Parent table

Specify the parent table in the relation.

Child table

Specifies the child table in the relation. This value is determined by the table you selected to get to this dialog. It is read-only.

Key Columns

Select one or more columns to act as the primary key in the parent table.

Foreign Key Columns

Select one or more columns to act as the foreign key in the child table. Typically, these must correspond to the columns you chose as your primary key, if not in name, then by data type and value.

Update rule

Select the Update rule to use when updating records. Applies to master-detail relationships and how detail records are updated when a master record is updated.

Delete rule

Select the Delete rule to use when deleting records. Applies to master-detail relationships and how detail records are deleted when a master record is deleted.

Accept/Reject rule

Select the Accept/Reject rule to use when an insert occurs in a master-detail relationship.