Adding foreign key

To add a foreign key:

Procedure

  1. Log on to the MXDM.
  2. In the Navigation tree pane, click Database.

    MXDM displays a list of available systems in My Systems.

  3. Expand a selected system in the navigation tree.

    List of catalogs for the selected system appears.

  4. Click and expand the contents of a Catalog.

    The list of schemas appears.

  5. Expand a schema in the left pane.

    The Tables folder appears.

  6. Expand the Tables folder and select a table in the left pane.
  7. Right-click the table and select Alter Table from the context menu.
  8. Select Add Foreign Key.

    Add Foreign Key dialog appears.

  9. Select Let SQL/MX choose the name to generate the foreign key constraint name automatically, else explicitly provide a foreign key constraint name in the Name field.
  10. Select referential action for On Delete and On Update rules. The following are the possible values:
    • No Action
    • Restrict
    • Cascade
    • Set Default
    • Set Null
  11. Select a table from the Referenced Table tree and click Add to launch Specify Foreign Key Column Pair dialog to add the column pairs.

    Specify Foreign Key Column Pair dialog appears with Referencing Columns and Referenced Columns grids.

  12. Select a column from the Referencing Columns grid to populate the Referenced Columns grid with the columns that match the data type of the referencing column.
  13. Click OK to add a column pair in Add Foreign Key dialog.
  14. Click OK to add foreign key to the table or click Cancel to discard the changes.