Create Relationships Between Tables on a Diagram (Visual Database Tools)

Applies to: SQL Server

You can create relationships between columns in different tables in the Diagram Designer by dragging columns between tables.

To create a relationship graphically

  1. In Database Designer, click the row selector for one or more database columns that you want to relate to a column in another table.

  2. Drag the selected column(s) to the related table.

  3. Two dialog boxes appear: Foreign Key Relationship and Tables and Columns, with the latter appearing in the foreground.

  4. Relationship name has a system-provided name in the format FK_localtable_foreigntable. You may change this value.

  5. Verify that Primary key table specifies the correct table.

  6. The grid lists the local columns and their matching foreign columns. You can add or remove table columns or change mappings.

  7. Choose OK.

    The Foreign Key Relationship dialog box appears. Selected Relationship shows the relationship you have created.

  8. Change properties for the relationship in the grid.

  9. Choose OK to create the relationship.

    Database Designer shows a relationship between the columns you chose.

See Also

Tables and Columns Dialog Box (Visual Database Tools)
Working with Constraints
Work with Tables in Database Diagram (Visual Database Tools)