SQL Server: Relationships

In a previous article, I spoke about Referential Integrity within SQL Server when migrating from Microsoft Access. For the same audience, this article shows how to create a “Database Diagram” similar to the ones that can be created using the “Relationships” panel within Microsoft Access.

To create a “Relationship” Diagram within SQL Server

Before you make any changes to any live / production database, ensure that the data and schema is fully backed up!

Using SSMS (SQL Server Management Studio), connect to the SQL Server Database you wish to work on. Expand the appropriate database container and click on “Database Diagrams”. You will be prompted to install the “Database Diagramming Support Objects” if you have not previously done so.

Database Diagram 001

Next, you will be prompted to add the tables you wish to include in you diagram.

Database Diagram 002

If you have already established your Referential Integrity settings (I recommend you do that first), the relationships between the tables will be automatically added to the diagram.

Database Diagram 003

Finally, Save the diagram.

Database Diagram 004

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s