I have created a new Database Diagram in Test Database and it is in sitde01 Server. Now I want to move it to another server. How do I migrate it to another server.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It can be done, but it’s a royal pain. Here’s an outline of the process and some scripts.
Diagrams are stored in a “system” table named sysDiagrams. This table (only?) gets created when you click on the diagrams node in SSMS, it asks you if you want to create the objects that support diagrams, and you click “Yes”. Do so on both your source and target databases.
Create the diagram or diagrams in the “source” database.
Review the structure and contents of sysDiagrams. Note that column
diagram_idis an identity column. 1 row gets stored for every diagram. (You don’t care, but it used to be 4 or 5 rows in SQL 2000.)To copy to another database on the same SQL instance, the simplest way is to do INSERT… SELECT… between tables. With that identity column in the way, you’ll have to fuss with SET IDENTITY_INSERT, and perhaps assign a new identity value on the target computer. Irritating, but not critically hard.
The following script will copy all diagrams from one database to another that’s on the same server (this is how I archive complex diagrams that took waaaay too long to create, from databases that are prone to get dropped and recreated):
To copy to another database on a different SQL instance (or server), well, it gets even harder. I use temporarily created Linked Server definitions, using scripts I sweated bullets over years ago and never want to have to modify again (i.e. post a different question so someone who knows can tell you how they work), and modify the scripts with appropriate four-part naming conventions. Other options (OPENROWSET and the like) are possible, but I’m even less familiar with those.