The script generates an import script for SQL Server Management Studio diagrams.
Easy to use, exports all diagrams in current database, to a script. Tip: Place it in your repository.
Remarks
The name of diagrams need to be unique in database. The script replace an existing diagram.
Verify existing diagram names first! List the database diagram(s) for current database:
select [name] from dbo.sysdiagrams;
Usage
Run the script against a database and select Results to File.
To restore diagram(s), to another database, just run the saved file.
Note
Objects required to use database diagrams is added for owner, when clicking on folder Database Diagrams in SSMS.
Further reading
Revisions
- 1.0 2018-05-25 First version
- 1.1 2018-09-11 Replace existing diagram
- 1.2 2018-11-09 Skip the
use dbName
line, so restore can be done to any database.