Jolley71717
Jolley71717

Reputation: 718

How do I update a database Diagram in Microsoft SQL Server Management Studio

I currently have the database diagram window open in Microsoft Server Management Studio 2014. Is there a way to "refresh" the view so that I can see a newly added foreign key constraint?

Upvotes: 10

Views: 8981

Answers (3)

Pic Mickael
Pic Mickael

Reputation: 1274

In Microsoft SQL Management Studio 19 (and higher, could not test lower version) If you just added the column to your table through and Alter command,

  1. Make sure your diagram is closed.
  2. Then refresh your table (In Object Explorerright, under Tables, right-click your table, select Refresh)
  3. Refresh your diagram (In Object Explorerright, under Database Diagrams, right-click your table, select Refresh)
  4. Open your diagram and the new column(s) should appear

Step 2 is important, otherwise the Object Explorer does not know about the new column, and it won't be able to add it to your diagram.

Upvotes: 0

dan-iel
dan-iel

Reputation: 839

Close the diagram. Right click on the diagram name under the "Database Diagrams" node on the tree to the left and select "Refresh", then re-open the diagram. That worked for me when I was trying to get the new fields, updated field names, and updated "nullable" values to display. It also didn't scramble the custom layout I did in the diagram, which I was afraid might happen. If your diagram is missing entire tables, then open the diagram, right click in the diagram's blank space, and select "Add Table" to add missing tables.

This was the first result that came up when I was trying to figure out how to refresh the tables to reflect new fields and such. I was hoping I wouldn't have to delete/re-add each table one-by-one!

Upvotes: 8

Jolley71717
Jolley71717

Reputation: 718

It looks like the best way is to right click on the diagram and choose "remove table from diagram". Then right click in the white space and choose "Add Table". It will then show newly created relationships.

Upvotes: 6

Related Questions