Thursday, 9 April 2009

MS SQL Server How To - Creating relationships in a database diagram

This one had me scratching my head for 5 minutes, so I thought I would share it.

If you want to create relationships in your SQL Server 2005 database diagram:

  1. Right-click the table that contains the foreign key (FK) in the forthcoming relationship.
  2. To create the relationship, click the ellipsis (...) box to the right of "Tables and Columns Specification". (This is quite hard to see.)
  3. In the Tables and Columns dialog, you can now select the tables, FK, and PK (Primary Key) that will participate in the relationship.

Have fun!