get names of the tables in a database diagram

enrique_aeo used Ask the Experts™
Hi experts,

 Is there any procedure store that allows me to get the names of the tables in a database diagram created in SSMS
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Contract ERP Admin/Consultant
Short answer: No
Long answer: No

In SSMS change your Options, Query Results, Sql Server, Results to Text, and set max num of characters to 8000. Then press Ctrl-T (to see results in text mode). Then run this query.

SELECT  name,
        CONVERT(varchar(max), definition) AS definition
FROM    sysdiagrams

Now, look through the text, and you will see table names (double-spaced). The problem is finding a consistent way to know where to programmatically isolate the file name.

You can change back to showing results in grid mode with Ctrl-D.
No such type of system stored procedure or system view in sql. Definition of diagram stored in varbinary formate. You can see in dbo.sysdiagrams table.



this is the best you can get?
dsackerContract ERP Admin/Consultant

this is the best you can get?
No. This is the best anyone can get.

If you wish for someone to develop a tool that might (very) intelligently sort through the binary data in sysdiagrams, there are a number of consultants here (including me) that can offer rates.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial