Dela via


How to: Modify Foreign Key Relationships (Visual Database Tools)

Modify the foreign key side of a relationship if you want to change which columns are related to columns in the primary key table.

To modify a foreign key

  1. In Object Explorer, right-click the table with the foreign key, and click Design. The table opens in Table Designer.

  2. From the Table Designer menu, click Relationships.

  3. In the Foreign Key Relationships dialog box, select the relationship in the Selected Relationship list.

  4. In the grid, click the Tables and Columns Specifications and click the ellipses (…) to the right of the property.

  5. In the Tables and Columns dialog box, select a different table column from the list. The foreign key column must match the data type and size of the primary key column, with these exceptions:

    • A char column or sysname column can relate to a varchar column.

    • A binary column can relate to a varbinary column.

    • An alias data type can relate to its base type.

Any changes you make to the relationship's properties take effect as soon as you move outside the grid in Table Designer. The constraint is updated in the database when you save your table.