C# articles and tutorials on SharpDeveloper.NET

Sharpen your .NET skills with our C# articles, tutorials, demos, and source code by Sameer Alibhai
posts - 63, comments - 53, trackbacks - 1

Copy A Database Diagram To Another Database

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.

Print | posted on Saturday, April 19, 2008 5:18 PM | Filed Under [ SQL ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 2 and 5 and type the answer here:

Powered by: