Online Documentation for SQL Manager for DB2

Foreign Key Editor


The Foreign Key Editor dialog allows you to view/edit the Foreign key fields. It opens when you create a new Foreign key or view an existing one (see Create Foreign key and View Foreign key for details).

 

Tables - Foreign Key Editor

 

 

Enter the Foreign key name in the corresponding box. Note that the name of the Foreign key must be unique among all the Foreign key names in the schema.

 

Use the Table Name box to set the table in which the Foreign key is created.

 

The Table Fields area allows you to select Foreign key field(s).

To select a field, you need to move it from the Available fields list to the Selected fields list. Use the Move to Selected Move to Available buttons or drag-and-drop operations to move the fields from one list to another.

 

Foreign table name

Use the drop-down list to select the foreign table.

 

The Foreign Table Fields area allows you to select the field(s) of the Foreign table.

To select a field, you need to move it from the Available fields list to the Selected fields list. Use the Move to Selected Move to Available buttons or drag-and-drop operations to move the fields from one list to another.

 

 

On Delete rule / On Update rule

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

  • RESTRICT

If specified, an error occurs and no rows are deleted/updated.

  • Set NULL

Set the referencing column(s) to null.

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