Is there a way to visually display a View in a database diagram in SQL Server 2008?
Asked Answered
J

2

7

I would like to create a database diagram in SQL Server 2008 and have a View in the diagram. is there a way to do this?

Jehanna answered 25/8, 2011 at 17:52 Comment(1)
No, but Microsoft BI's Data Source View allows for this, and a whole lot more.Pitchman
F
12

I don't think so. SQL Server Management studio allows only Tables to be included in the database diagram. If you have Microsoft Visio, you can use that to include the Views in your database diagram.

Froude answered 25/8, 2011 at 18:0 Comment(0)
G
4

Download SQL Sentry Plan Explorer - this is a free app that significantly extends the built-in execution plan functionality in Management Studio. Also grab the Management Studio add-in (you'll have to re-start SSMS). Once installed, in SSMS, run the following query, with "Actual Execution Plan" turned on:

SELECT * FROM dbo.view;

Right-click the Execution Plan and choose "View with SQL Sentry Plan Explorer."

Once the plan is open in Plan Explorer, you can see the base tables that are referenced by the view (even if they are nested) on the Join Diagram tab in the lower pane.

Disclaimer: I work for SQL Sentry, but there are absolutely no strings attached.

Gallicize answered 25/8, 2011 at 18:30 Comment(5)
Just so I understood the idea correctly, this app is about more advanced display of query plans, right? Because the OP is asking about diagrams, not plans. So your suggestion is a sort of workaround, am I correct? I'm mainly asking to make sure I haven't misunderstood the purpose of this tool.Bravissimo
@Andriy One of the features of the tool is that it can show you the join diagram for a plan, including the simple case such as the query I showed. Whether you want to call that an answer or a workaround is just semantics, I think. If it shows a visual diagram of the joins in the view, then I think it answers the question. The question was not "is there a tool that is solely dedicated to visually describing a view?"Gallicize
No, it wasn't, and thanks to one of the screenshots I found there I can now see what you mean. That is a great feature, for a free app too. Still I think that answers the question only partly. I understand the OP wants the views to be included into a complete database diagram, so as (probably) to show the relationships between the views' underlying tables in conjunction with other relationships in the database.Bravissimo
Ok, I'll gladly admit that it only partly answers the question. Again, semantics. How are you propose to do this in Management Studio? The other answer mentions Visio. No problem with that, except Visio is expensive. It might be worth the cost, or it may be useful to use a free product with a little more work (e.g. write a query with the joins you want to illustrate in the diagram, and then open that plan).Gallicize
I'm upvoting this answer anyway. The tool can still be helpful, especially when no other solution is possible at the time.Bravissimo

© 2022 - 2024 — McMap. All rights reserved.