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.
For these scenarios we've created a script that copies descriptions between documentations in one repository.
Script is a set of stored procedures that you install on the Dataedo repository database.
- Copies object (table, view, trigger, procedure, function, column, relation, unique key, parameter) desciptions and titles.
- Does not copy schema (tables, columns etc.). You need to make sure that database schema was imported (and updated) prior to running script.
- Optionally overwrites user-defined objects: relations, unique keys, modules, ER diagrams.
To install stored procedures download script below. Then connect to Dataedo repository database (SQL Server) and execute the script.
This should create 3 stored procedures in your database:
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 databases.database_id column):
EXECUTE dbo.copy_doc_by_id @src_id=2, @dst_id=5, @create_user_obj=1;
Copying descriptions only
If you set @create_user_obj parameter to 0 procedure will only copy descriptions and titles.
Copying descriptions and user defined objects
If you set @create_user_obj parameter to 1 then procedure will overwrite all user-defined objects relations, unique keys, modules, ER diagrams.
Note: After running procedure hit Refresh view button on 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.