Partager via


How to: Manage Persistent Relationships Between Tables

You can edit and delete persistent relationships between database tables.

To edit a persistent relationship between tables

  1. Open the database in the Database Designer.

  2. In the Database Designer, click the relationship line between the two tables.

  3. On the Database menu, click Edit Relationship.

    Tip

    You can also double-click the relationship line between the two tables.

  4. In the Edit Relationship dialog box, change the settings you want.

For more information, see Edit Relationship Dialog Box.

To delete a persistent relationship between tables

  1. Open the database in the Database Designer.

  2. In the Database Designer, click the relationship line between the two tables.

  3. Press the DELETE key.

For more information, see Database Designer (Visual FoxPro).

To delete a persistent relationship between tables programmatically

  • Use the ALTER TABLE command and include the DROP FOREIGN KEY clause.

For more information, see ALTER TABLE - SQL Command.

For example, the following code deletes a persistent relationship between two tables, Customer and Orders, based on the primary index key, Cust_ID, in the Customer table and a foreign key, Cust_ID, in the Orders table:

ALTER TABLE Orders DROP FOREIGN KEY TAG Cust_ID SAVE

See Also

Tasks

How to: Open Databases

How to: Build Referential Integrity Between Tables

Other Resources

Creating Databases

Working with Items in Databases