In Sybase Central, the foreign key of a table appears on the Constraints tab, which is located on the right pane when a table is selected.
You create a foreign key relationship when you create the child table (that is, prior to inserting data in the child table). The foreign key relationship then acts as a constraint; for new rows inserted in the child table, the database server checks to see if the value you are inserting into the foreign key column matches a value in the primary table's primary key.
After you have created a foreign key, you can keep track of it on each table's Constraints tab in the right pane; this tab displays any foreign tables that reference the currently selected table.
Connect to the database as a user with DBA authority, or as the owner of the table.
In the left pane, double-click Tables.
Right-click the table and choose New » Foreign Key.
Follow the instructions in the Create Foreign Key Wizard.
Connect to the database as a user with DBA authority, or as the owner of the table.
In the left pane, double-click Tables.
Select the table for which you want to delete a foreign key.
In the right pane, click the Constraints tab.
Right-click the foreign key and choose Delete.
Click Yes.
For any given table, you can also view a list of tables that reference the table using a foreign key.
Connect to the database as a user with DBA authority, or as the owner of the table.
In the left pane, double-click Tables.
Click the table.
In the right pane, click the Referencing Constraints tab.
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, select the foreign key on the Constraints tab and then choose File » Properties.
You can view the properties of a referencing foreign key by selecting the table on the Referencing Constraints tab and then choosing File » Properties.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |