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

niwlg2el  于 11个月前  发布在  SQL Server
关注(0)|答案(3)|浏览(135)

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?

fquxozlt

fquxozlt1#

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!

9rbhqvlz

9rbhqvlz2#

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.

6ss1mwsb

6ss1mwsb3#

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.

相关问题