Saturday, February 25, 2012

No way to save database diagram outside of database?

This is to express my frustration that there's apparently no way to save a database diagram outside of the database that it's diagramming.

Like many developers, we maintain our databases under source control as SQL scripts. When we need to install the database, we just run the scripts to build the database, from scratch, no need to save any binaries.

I recently took the time to create a database diagram for one of our existing databases, using the tool in Management Studio (2005). For starters, the diagram editor is a primitive toy that lacks many obvious features. But now I that I have the diagram, I find I've painted myself into a corner: The next time I want to build the database from script, I'll lose the diagram, because as far as I can tell, it's persisted as a BLOB in a system table.

I thought maybe I would be able to right-click on the diagram and that I would find an option to "Save diagram to script", or something like that, but the closest I get is "Copy diagram to clipboard" [as a bitmap]. I could save the bitmap, but this leaves me with something I can't maintain.

I might suggest that the Visual Database Tools team take a look at the Visual Studio class diagrams. The editor for these is also a rather primitive toy, but at least the diagrams are persisted as XML, so you can save the diagram script as text in source control, and if you need the diagram to look better than the designer will do on its own, you can edit the code.

Thanks for your consideration. If there is a way to do what I want that I've overlooked, I would appreciate if someone would let me know.

-Allan

1. Insert the rows in dbo.sysdiagrams into a common dev database before you script a new database then reinsert them into a newly created sysdiagrams table when you create a database from the script.

2. Use Visio

|||

Sorry to hear you are unhappy with the database diagram. We've had a number of suggestions filed on Microsoft Connect to improve this area: http://connect.microsoft.com/SQLServer/feedback/SearchResults.aspx?SearchQuery=diagram.

Take a look through those and vote on the issues that are important to you. If you feel there are issues another customer hasn't filed, submit a new suggestion and we'll take it into consideration.

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

No comments:

Post a Comment