다음을 통해 공유


Tables and Columns Dialog Box

Use this dialog box to map a primary key in one table to a foreign key in another. To access this dialog box, from the Table Designer menu click Relationships. In the Foreign Key Relationships dialog box, click the Tables and Columns Specification field and then click the ellipses (…) to the right of the property.

Note

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 Customizing Development Settings in Visual Studio.

  • Relationship name
    Shows the name of the relationship.

  • Primary Key Table
    Lists the tables in the database. Choose the table that will be on the primary-key side of the relationship.

  • Foreign Key Table
    Shows the table on the foreign key side of the relationship. This is the table currently selected in Table Designer.

  • Grid beneath Primary Key Table
    List the columns of the table selected in the Primary Key Table list. Enter the columns contributing to that table's primary key.

  • Grid beneath Foreign Key Table
    List the columns of the table selected in the Foreign Key Table list. Enter the foreign-key column of the foreign-key table that corresponds to the primary key column.

Note

The columns you choose for the foreign key must have the same data type of the primary columns they correspond to. There must be an equal number of columns in each of the keys. For example, if the primary key of the table on the primary side of the relationship is made up of two columns, you will need to match each of those columns with a column in the table for the foreign key side of the relationship.

See Also

Tasks

How to: Create Relationships Between Tables

Reference

Foreign Key Relationships Dialog Box

Other Resources

Working with Relationships