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

 

4 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.

  4. Justin says:

    I ended up using an open query due to databases living on a different sever. Worked for me as well, thanks.

Leave a Reply

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

*


3 + = 12

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>