ASA SQL User's Guide
Working with Database Objects
Working with tables
Managing foreign keys
In Sybase Central, the foreign key of a table appears on the Foreign Keys tab (located on the right pane when a table is selected).
You cannot create a foreign key in a table if the table contains values for the foreign columns that can't be matched to values in the primary table's primary key.
After you have created a foreign key, you can keep track of it on each table's Referencing Tables tab in the right pane; this folder displays any foreign tables that reference the currently selected table.
To create a new foreign key in a given table (Sybase Central)
Select the table for which you wish to create a foreign key.
Click the Foreign Keys tab in the right pane.
From the File menu, choose New > Foreign Key.
The Foreign Key Creation wizard appears.
Follow the instructions in the wizard.
To delete a foreign key (Sybase Central)
Select the table for which you wish to delete a foreign key.
Click the Foreign Keys tab in the right pane.
Right-click the foreign key you want to delete and choose Delete from the popup menu.
To display which tables have foreign keys that reference a given table (Sybase Central)
In the left pane, select the desired table.
In the right pane, click the Referencing Tables tab.
TipsWhen you create a foreign key using the wizard, you can set properties for the foreign key. To view properties after the foreign key is created, right-click the foreign key on the Foreign Keys tab and choose Properties from the popup menu.You can view the properties of a referencing table by right-clicking the table on the Referencing Tables tab and choosing Properties from the popup menu. |