如何使用 Microsoft SQL Server 的 ManagementStudio 生成数据库的实体关系图?

我想使用 MicrosoftSQLServerManagementStudio(SMSS)生成一个 SQL 数据库的 ER 图。但是,我不知道怎么做。

我在网上找到了这个技巧: 从 SQL Server 2008数据库制作 ER 图

但是,我不能看到“数据库节点”或“数据库关系图”节点,如第一步和第二步中提到的。

因此,如何从现有数据库生成 ER 图表?

从评论中,我意识到我的理解是正确的,数据库节点意味着与我的数据库名称的节点。但是,我的问题是,我无法找到“数据库关系图”节点在我的数据库名称。我该怎么做才能看到它呢?

附言: 这不是一个本地数据库。

290755 次浏览

From Object Explorer in SQL Server Management Studio, find your database and expand the node (click on the + sign beside your database). The first item from that expanded tree is Database Diagrams. Right-click on that and you'll see various tasks including creating a new database diagram. If you've never created one before, it'll ask if you want to install the components for creating diagrams. Click yes then proceed.

  1. Go to SQL Server Management Studio
  2. Object Explorer
  3. Databases
  4. Choose and expand your database.
  5. Under your database, right click on "Database Diagrams" and select "New Database Diagram".
  6. It will a open a new window. Choose tables to include in the ER diagram (to select multiple tables, press Ctrl or Shift key and select tables).
  7. Click Add.
  8. Wait for it to complete. Done!

You can save the generated diagram for future use.

Screenshot

Diagrams are back as of the 2019-06-11 release

Download the latest

As stated:

Yes, we’ve heard the feedback; Database Diagrams is back.

SQL Server Management Studio (SSMS) 18.1 is now generally available


Note: The latest version does not include it

Sadly, the last version of SSMS to have database diagrams as a feature was version v17.9.

Since that version, the newer preview versions starting at v18.* have, in their words "...feature has been deprecated".

Hope is not lost though, for one can still download and use v17.9 to use database diagrams which, as an aside for this question, is technically not an ER diagramming tool.


As of this writing it is unclear if the release version of 18 will have the feature. I hope so because it is a feature I use extensively.

As of 2019-10, for SQL Server Management Studio, they did not upgrade it to add the create ER Diagram feature.

I would suggest try using DBeaver:

I am using both Mac and Windows and I was able to download the community edition. I logged into my SQL server database and was able to create the ER diagram using the DBeaver.

ER Diagram using the Community Version database viewer