Documentation

Table of Contents:


    Copy descriptions between documentations

    2018-12-02
    Applies to: 7.x (current), Article available also for: 6.x, 5.x

    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 shanges 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

    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) desciptions and titles.
    2. Does not copy schema (tables, columns etc.). You need to make sure that database schema was imported (and updated) prior to running script.
    3. Optionally overwrites user-defined objects: relations, unique keys, modules, ER diagrams.

    Installing

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

    Download script with procedures

    This should create 3 stored procedures in your database:

    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 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 @create_user_obj parameter to 0 procedure will only copy descriptions and titles.

    @create_user_obj=0;
    

    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.

    @create_user_obj=1;
    

    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.

    Found issue with this article? Comment below
    Comments (0)