Copy A Database Diagram To Another Database

April 19th, 2008 by Sameer | Filed under SQL.

For some reason SQL Server doesn’t have an easy way to "Create TO" for database diagrams, unlike stored procedures, functions ,etc.

Here is how you can achieve moving a database diagram (or copying a database diagram) in SQL Server 2005

use Old_Database

go

--this will copy your database diagrams into a temporary table

select * into dbo.#tempsysdiagrams from sysdiagrams

use New_Database

go

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

That’s it, so easy.

Other Interesting Posts

3 Responses to “Copy A Database Diagram To Another Database”

  1. WhatiIsThePoint says:

    Why post a blob and cover it with ads so you cannot read the content. Quite silly.

  2. Sameer says:

    Looks fine on my monitor, anyway you can “view plain” or “copy to clipboard” if you like

  3. Irfan Ahmad (Isfan) says:

    Thanks a lot. It helps me today. Thank you very much.

Leave a Reply