Sunday, October 30, 2016

Database diagramming in SQL Server 2016

Database diagram is a diagram that consists of a number of tables displayed on it with or without showing the relationships between the tables. It can also be edited for logical relationships; get a print out of database structures, etc.

Here are steps to create database diagram in SQL Server 2016 for the AdventureWorks2014 database.

Click Database Diagrams under AdventureWorks 2014 which is presently empty as shown:


InstallDBDiagSup_00

The top two items in the drop-down menu are

New Database Diagram
Install Database Diagram Support

Click on Install Database Diagram support. You get a message about objects missing that support diagram support.


InstallDBDiagSup_01
Click Yes to go ahead and create objects to support diagramming. Nothing happens after you click Yes.

Click the Database Diagram node one more time. Now you get only one option - New Database Diagram.





InstallDBDiagSup_02

Click New Database Diagram and a designer gets created bringing up a pick list of tables in the database as shown.



InstallDBDiagSup_03

With CTRL key held down you can select multiple tables as shown.


InstallDBDiagSup_04

After selecting table or tables click Add to add them to the diagram as shown.



InstallDBDiagSup_05

If you try to close the diagram you will be asked to save it as shown.


InstallDBDiagSup_06

Clicking Yes asks you for the name you want for this diagram. Provide a name and click OK.

InstallDBDiagSup_07

You get a Save message a shown. You can save it in SSMS or save it to a text tile.



InstallDBDiagSup_08

If you click Yes it gets saved to the server as shown in the Database Diagram node.



InstallDBDiagSup_09