Creating a Foreign Key

Create a foreign key to constrain a column based on values in a reference table.

A foreign key:

  1. In the left pane of the Administration Console, expand ASE Servers > Schema Objects > Tables, then choose one of the following:
    • User Tables
    • Proxy Tables
  2. Click the Name field of the table, then click the drop-down arrow and select Properties.
  3. In the left pane, click Foreign Keys.
  4. Select New.
  5. On the Referenced Table screen:
    1. Select the database that contains the table that the foreign key references.
    2. Select the referenced table of the foreign key,
    3. Provide a name for the foreign key.
  6. On the Referenced Column screen:
    1. Select the key to which the foreign key references.
    2. Select columns from the Foreign Key Column to match to columns in Primary Key Column.
      Foreign key values should be copies of the primary key values. No value in the foreign key should exist unless the same value exists in the primary key.
  7. (Optional) Click Summary to review your selected options.
  8. Click Finish .
Related tasks
Creating a Check Constraint
Creating a Unique Constraint or Primary Key
Binding Defaults and Rules to a Column