SQL Server 2005 | Copy Database Diagrams

Next is the code to copy database diagrams from one database to another (tested on SQL Server 2005 and 2008)


DROP TABLE dbo.#tempsysdiagrams
–this will copy your database diagrams into a temporary table
select * into dbo.#tempsysdiagrams from sysdiagrams


insert into sysdiagrams ([name],principal_id,version,definition)
select [name],principal_id,version,definition from dbo.#tempsysdiagrams where [name]=’DIAGRAM_NAME’

Happy Diagramming


No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *