Home All Groups Group Topic Archive Search About

Include db diagrams in scripts

Author
11 May 2006 1:19 PM
Geir Morten
Hi,
Is it possible to include the db diagrams when using the SQL Server scripts
wizard  in management studio on a database (SQL Server 2005)?
If not, why not?
What is the best pratice to export these diagrams for documentation, for
example to developers?

Thanks

Author
14 May 2006 2:58 AM
nate.vu
Hi Geir,

I don't think you are able to script out a database diagram. Database
diagrams are stored in the "sysdiagrams" table of each database. In
this table the diagram is stored in a column with a varbinary(max)
datatype, which (I presume) SQL Server translates the data in this
column to the diagram you see on screen.

Thus, there is no human-readable definition of the diagram and so I
don't think you can script it out.

In shops I have worked in before, developers would submit database
diagrams to the database team/section by taking a screenshot of them
and placing the screenshot in a Word document or picture file (e.g.
..png, .bmp).

It might also be possible to link SQL Server with a tool like Visio and
use Visio's data modelling capabilities to generate and export a
diagram.

Do you require the diagrams for documentation (e.g. a system spec) or
do the developers just need to see it on the screen? If they only need
to view it on their screens, you could consider letting them create the
diagrams themselves (e.g. place a copy of the database on a development
SQL Server box and let the devs create the diagram).

Sorry I can't be of more help.
Author
14 May 2006 2:40 PM
Geir Morten
Thank you, this was really helpful.

Show quote
"nate***@gmail.com" wrote:

> Hi Geir,
>
> I don't think you are able to script out a database diagram. Database
> diagrams are stored in the "sysdiagrams" table of each database. In
> this table the diagram is stored in a column with a varbinary(max)
> datatype, which (I presume) SQL Server translates the data in this
> column to the diagram you see on screen.
>
> Thus, there is no human-readable definition of the diagram and so I
> don't think you can script it out.
>
> In shops I have worked in before, developers would submit database
> diagrams to the database team/section by taking a screenshot of them
> and placing the screenshot in a Word document or picture file (e.g.
> ..png, .bmp).
>
> It might also be possible to link SQL Server with a tool like Visio and
> use Visio's data modelling capabilities to generate and export a
> diagram.
>
> Do you require the diagrams for documentation (e.g. a system spec) or
> do the developers just need to see it on the screen? If they only need
> to view it on their screens, you could consider letting them create the
> diagrams themselves (e.g. place a copy of the database on a development
> SQL Server box and let the devs create the diagram).
>
> Sorry I can't be of more help.
>
>
Author
16 May 2006 3:10 PM
Nils Loeber
Other than that, you might consider printing the diagram and redirecting the
output to a file or print it using a pdf generator which should. You
wouldn't even have to spend money on Adobe Acrobat, since there are a number
of free PDF printer drivers. See
http://en.wikipedia.org/wiki/List_of_PDF_software.

Best regards,
Nils Loeber

<nate***@gmail.com> schrieb im Newsbeitrag
Show quote
news:1147575514.921604.191170@g10g2000cwb.googlegroups.com...
> Hi Geir,
>
> I don't think you are able to script out a database diagram. Database
> diagrams are stored in the "sysdiagrams" table of each database. In
> this table the diagram is stored in a column with a varbinary(max)
> datatype, which (I presume) SQL Server translates the data in this
> column to the diagram you see on screen.
>
> Thus, there is no human-readable definition of the diagram and so I
> don't think you can script it out.
>
> In shops I have worked in before, developers would submit database
> diagrams to the database team/section by taking a screenshot of them
> and placing the screenshot in a Word document or picture file (e.g.
> .png, .bmp).
>
> It might also be possible to link SQL Server with a tool like Visio and
> use Visio's data modelling capabilities to generate and export a
> diagram.
>
> Do you require the diagrams for documentation (e.g. a system spec) or
> do the developers just need to see it on the screen? If they only need
> to view it on their screens, you could consider letting them create the
> diagrams themselves (e.g. place a copy of the database on a development
> SQL Server box and let the devs create the diagram).
>
> Sorry I can't be of more help.
>

AddThis Social Bookmark Button