13

In SQL Server Management Studio, I have relationships set up between tables.

Is there a way to display a view of all the tables with the adjoining lines like in Microsoft Access? Do I need to open a new query and run something or is there a button that I've missed?

4 Answers 4

16

If you are using Management Studio 2008 :

Expand the root Database, try and expand the Database Diagrams folder, it should say something like "no diagrams".

If it asks you to create a diagram say yes, then add the tables and voila!

If not, right on Database Diagrams folder and create new Diagram.

3
  • 3
    That is very helpful, but I don't want to create a diagram, I want to see the current relationships between tables. If I create a diagram, it's just whatever I put on the diagram...
    – LtDan
    Jul 13, 2011 at 20:11
  • 4
    If you create the diagram and add your tables, it automatically adds the relationships..... like in access. Try it
    – leinad13
    Jul 14, 2011 at 14:41
  • for me is not as no one table has Foreign keys Jul 3, 2020 at 13:34
4

If you want to display dependencies for specific table just select your table and right-click View Dependencies. Check how to view dependencies.

SQL Server 2005 lets you display dependencies like this

SELECT OBJECT_NAME(object_id) referencing,
  OBJECT_NAME(referenced_major_id),
  *
FROM sys.sql_dependencies 

SQL Server 2008 has sys.sql_expression_dependencies follow this link

1
  • Great alternative! I'm working with a massive DB (1,500+ tables) that I absolutely do not want to generate a whole diagram for. This is great for getting a table-by-table view of relationships without having to process an entire DB worth of tables.
    – zcoop98
    Feb 23, 2021 at 18:20
4

Try out ApexSQL Search

ApexSQL Search is a FREE SQL Server Management Studio and Visual Studio add-in that, among other features, has the View Dependencies feature. The View Dependencies feature has the ability to visualize all SQL database objects’ relationships, including those between encrypted and system objects, SQL server 2012 specific objects, and objects stored in databases encrypted with Transparent Data Encryption (TDE)

The View Dependencies feature also allows you to set up and customize the visual dependencies diagram layout, including the relationships that will be presented, the layout and size of the generated diagram, and the drill-down depth of the dependencies

0

I am reading this question in 2015 and I am using SQL Server 2012. In this scenario, in order to view the dependencies of a table, you can follow these steps:
1. At the root folder of your database, there is a folder called Database Diagrams. Expand this database and click 'yes' in the pop up that is going to appear;
3. Right click the field that you suspect it has a dependency, normally they have the letters ID in their names, for example, I am in the EPM database and in the table MSP_Projects we have the field Proj_UID, right click the field;
4. In the context menu that appears, select the item Relationships. At the left site of the window you will see the foreign keys related with this primary key, and at the right side of the window you will see the properties of the existing relationship.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .