Contents Index Managing foreign keys Managing foreign keys (SQL)

ASA SQL User's Guide
  Working with Database Objects
    Working with tables
      Managing foreign keys

Managing foreign keys (Sybase Central)

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)

  1. Select the table for which you wish to create a foreign key.

  2. Click the Foreign Keys tab in the right pane.

  3. From the File menu, choose New > Foreign Key.

    The Foreign Key Creation wizard appears.

  4. Follow the instructions in the wizard.

To delete a foreign key (Sybase Central)

  1. Select the table for which you wish to delete a foreign key.

  2. Click the Foreign Keys tab in the right pane.

  3. 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)

  1. In the left pane, select the desired table.

  2. In the right pane, click the Referencing Tables tab.

Tips 
When 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.


Contents Index Managing foreign keys Managing foreign keys (SQL)