SQL Server - How to import or export diagrams?

December 2016

SQL Servers allow the import or export of database diagrams to another database. All the information related to a database is stored in the dtproperties table. Therefore, to import or export a database, the dtproperties table will have to be imported or exported too. The database which contains a transfer scheme can be used to export to another database. Configuration is done automatically in the source database but has to be done manually in the destination database. To transfer the data from one database to another, the 'select all tables and view sources' option must be used to transfer to the dtproperties table in the destination column.


SQL Server - How to import or export diagrams?



Issue


Is it possible to import or export a diagram from one database to another with SQL Server?

Solution


Information about the diagrams is stored in the dtproperties table. Basically to import or export a diagram, you simply need to import or export the dtproperties table.
Follow the below procedure:
  • 1 - Right click on the database containing the diagrams. Click on "All Tasks" then on "Export data".
  • 2- The Import / Export option will be displayed, click "Next".
  • 3- Define the source and then click Next. Normally the configuration is done automatically.
  • 4- Configure the destination database and click Next.
  • 5- In the "Specify Copy or Query Table..." section , click Use a query to specify a data transfer, then click Next.
  • 6- On the Enter the SQL statement, type the following line:" Select * From dtproperties " then click Next.
  • 7- On the Select all tables and sources, choose the dtproperties table in the destination column and then click Next.
  • 8- Click on "Run immediately", then click Next and finally click Finish.

Related :

This document entitled « SQL Server - How to import or export diagrams? » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.