Dump & load in separate databases.

shining

New Member
Hi everyone,

I have trouble and wondering if anyone can help me. (I'm using Progress OpenEdge 10B)

I have 2 databases (production and test) and i want to pick up/dump some tables from one of these in a .d file (for example). Once done, i want to clear the second database tables and load the .d files.

My problem is as follows: I want to dynamically generate the queries, passing the name of the tables in parameter.
For more simplicity, here is a piece of code to illustrate my point:
Code:
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE lst_tables AS CHARACTER EXTENT 3 INITIAL ["t1", "t2", "t3"].

/* Dump of tables */

/* An include file to connect databases on server */
{E:\pgm\connect.i serv1 prod}

DO i = 1 TO EXTENT(lst_tables):
    OUTPUT TO VALUE("E:\temp_"  + lst_tables[i] + ".d").
    /* Doesn't work, naturally :awink: */
    FOR EACH lst_tables[i] NO-LOCK:
        EXPORT lst_tables[i].
    END.
    OUTPUT CLOSE.
END.

{E:\pgm\disconnect.i prod}

/* Load of tables */
{E:\pgm\connect.i serv2 test}
DO i = 1 TO EXTENT(lst_tables):
    FOR EACH lst_tables[i] NO-LOCK:
        DELETE lst_tables[i].
    END.
    INPUT FROM VALUE("E:\temp_"  + lst_tables[i] + ".d").
    REPEAT:
        CREATE lst_tables[i].
        IMPORT lst_tables[i].
    END.
    INPUT CLOSE.
END.

{E:\pgm\disconnect.i test}
I hope that it's achievable and have been quite clear.
Thanks in adavance for your answers.
 
Back
Top