SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Generate scripts for SQL Server Management Studio diagrams

By Jonas Gunnarsson,

The procedure generates an import script for SQL Server Management Studio diagrams.
Easy to use, takes one diagram name and two optional parameters, one if is first diagram to script the other if to add date to diagram name.

List the database diagram for current database:


select * from sysdiagrams;


The script is based on several other scripts, see the References in script.

Example of usage:


execute tool.ScriptDiagram 'First', 1;
execute tool.ScriptDiagram 'Second', 0;
execute tool.ScriptDiagram 'Third', 0;

Further reading

(fixed links and use only tab in code)

Total article views: 637 | Views in the last 30 days: 11
 
Related Articles
FORUM

Database diagrams

Database diagrams

FORUM

Database Diagram

Facing Problem with Database Diagram

FORUM

Transferring Database Diagrams

HOw can one transfer the database diagrams from one box to another

ARTICLE

Database Modeling and Diagrams with SQL Server 2008

How to use Database Diagram tool in SQL SERVER.

BLOG

Management Studio Database Diagram Owners

If you're working in an environment as a developer without sysadmin privileges, and you are creating...

Tags
diagram    
 
Contribute