Create a foreign key to constrain a column or columns based on column values in another table.
Before you can create a foreign key, be sure that the data server containing the table for which you are creating a foreign key is running, and you created and established a connection to the data server.
| Database | Steps |
|---|---|
| From an ASE connection profile |
|
| From a SQL Anywhere or Sybase IQ connection profile |
|
| Field | Description |
|---|---|
| Foreign Key Name | Enter a name for the foreign key in the text field, or leave the field blank for an auto-generated name. |
| Database | Choose a database for this data server. |
| Owner | Choose an owner for this data server. |
| Table | (Optional) Enter a filter expression for the tables to be displayed in the list of available primary tables. For example, * lists all tables for the specified database and owner combination. |
| Available Primary Tables | Highlight the table that you want this foreign key to reference. |
| Primary Key/Unique Constraints | Highlight the unique or primary key constraint in the primary table that this foreign key references. |
| Field | Description |
|---|---|
| Generate Script | Generate DDL for the foreign key. |
| Enter or Select the Parent Folder | Specify an existing project or create a new project in which to save the DDL. |
| File Name | Enter the name of the file in which to store the DDL. |
| Execute Immediately | Execute the DDL immediately. If you do not select this option, you must complete execution of the DDL later to create the foreign key. |
| Open in Editor After Creation | Create the foreign key and open it in the Table Schema Editor. |