Creating database diagrams can be a useful way to visualize the structure and relationships of your database tables. While there are sophisticated tools available for this task, such as ER/Studio or ERWIN, they may not always be necessary for creating simple diagrams. In this article, we will walk through how to create a database diagram using SQL Server Management Studio (SSMS).
Step 1 – New Database Diagram using SQL Server Management Studio
To begin, open SSMS and navigate to the desired database. Right-click on “Database Diagrams” and select “New Database Diagram”. This will open the Database Diagram tool.
Step 2 – Select a Table
In the Database Diagram tool, scroll through the list of tables and select the table you want to include in your diagram. For example, let’s choose the “Invoice” table. Press “Add” and then “Close”.
Step 3 – Add Related Tables
Next, right-click on the “Invoice” table and select “Add Related Tables”. This will automatically add tables that are linked to the “Invoice” table through foreign keys.
Step 4 – Eliminate Unwanted Tables
If there are any tables that you feel are not important or clutter the diagram, you can remove them by right-clicking on the table and selecting “Remove From Diagram”. This will help keep the diagram focused and organized.
Step 5 – Auto Arrange Tables
To avoid overlapping tables, right-click on the “Invoice” table and select “Arrange Tables”. This will automatically arrange the tables in a way that minimizes overlap.
Step 6 – Adjust the Layout
You can further customize the layout of the diagram by doing the following:
- Right-click to select a zoom level to see your tables more clearly.
- Drag a table to adjust its positioning.
- Click a table and put the cursor on the edge to resize the table layout.
Step 7 – Auto Size All Tables
To ensure that all tables are properly sized, use the shortcut CTRL + A to select all tables. Right-click on any highlighted table and select “Autosize Selected Tables”. You can also select and drag the connector lines to rearrange them as needed.
Step 8 – Copy to Clipboard
Once the diagram is sized and arranged as desired, save it and give it a name. Then, right-click on any white space in the diagram and select “Copy Diagram to Clipboard”.
Step 9 – Paste the Diagram to MS Word
Open Microsoft Word and insert a single-cell table. Paste the copied database diagram into the cell.
Step 10 – Adjust and Maximize the Database Diagram Image
Adjust the Word document to maximize the size of the database diagram image. Change the margins to 0.5 inches, enter the image, and resize it to enlarge it if necessary.
Once the diagram is in Word, you can print it, share it, or save it as a Word document or PDF file. This method provides an effective way to create simple, limited database diagrams that can be leveraged when documenting your database. You can also explore other options in SSMS Database Diagrams, such as showing only table names and relationships or displaying only key columns, which may allow for more tables to be added to the diagram while still fitting in a Word document.
By following these steps, you can easily create and share database diagrams using SQL Server Management Studio.
Article Last Updated: 2022-04-06