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)

use [DB_SOURCE_NAME]

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

use [DB_DESTINATION_NAME]

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

Happy Diagramming

Categories

No Responses

Leave a Reply

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