Skip to main content

Copy descriptions between documentations

There are many reasons to copy descriptions from one documentation to another.

You may want to create a duplicate documentation for your database as it was on a specific date (as an archive). Or maybe you finished developing a major change in your database and after moving changes from development to production database you also want to copy descriptions.

copy descriptions

For these scenarios, we've created a script that copies descriptions between documentations in one repository.

Script

The script is a set of stored procedures that you install on the Dataedo repository database.

The procedure:

  1. Copies object (table, view, trigger, procedure, function, column, relation, unique key, parameter) descriptions and titles.
  2. Does not copy schema (tables, columns, etc.). You need to make sure that the database schema was imported (and updated) prior to running the script.
  3. Optionally overwrites user-defined objects: relations, unique keys, modules, ER diagrams.

Installing

To install stored procedures, download the script below. Then connect to the Dataedo repository database (SQL Server) and execute the script.

Download script with procedures

This should create 3 stored procedures in your database:

copy descriptions procedures

Running procedures

This sample code will copy descriptions from documentation titled My Database (Dev) to the one titled My Database (Prod).

EXECUTE dbo.copy_doc
@src_title='My Database (Dev)',
@dst_title='My Database (Prod)',
@create_user_obj=1;

Alternatively, you can call the procedure with documentation IDs (you can find them in the databases.database_id column):

EXECUTE dbo.copy_doc_by_id
@src_id=2,
@dst_id=5,
@create_user_obj=1;

Two modes

Copying descriptions only

If you set the @create_user_obj parameter to 0, the procedure will only copy descriptions and titles.

@create_user_obj=0;

Copying descriptions and user-defined objects

If you set the @create_user_obj parameter to 1, the procedure will overwrite all user-defined objects: relations, unique keys, modules, ER diagrams.

@create_user_obj=1;

Note: After running the procedure, hit the Refresh view button on the Dataedo ribbon.

Copying entire documentation

If you want to create a duplicate of your documentation, first update your existing one (so that it matches the actual database), then import the same database as new documentation, then run the script above.