How to: Modify Foreign Key Relationships

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


The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To modify a foreign key

  1. In Server Explorer, select the table with the foreign key, and from the Data menu click Open Table Definition.

  2. The table opens in Table Designer.

  3. From the Table Designer menu, click Relationships.

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

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

  6. 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.

    • A user-defined 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.

See Also

Other Resources

Working with Keys

Working with Constraints