Results 1 to 5 of 5
  1. #1
    Join Date
    May 2011
    Posts
    15

    Red face Unanswered: How to use Export command inside SQL procedure

    Hi all,

    I am new DB2 user. I am having 3 databases prod, Dev , Test. and I want to synchronize these 3 databases. I want to take data from prod database and put it into test and devp.

    I tried a lot using cursors, arrays, but I didn't get any solution.

    Please give me the solution. it is argent.

    thanks.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What DB2 version and OS are you using. Have you looked at the db2move utility?

    Andy

  3. #3
    Join Date
    May 2011
    Posts
    15

    Red face Export command inside SQL procedure >DB2 version 8 and os is windows.

    I am using DB2 version 8 and os is windows.

    I am synchronizing the three databases.

    CONNECT TO CAEEDMP USER "caeedm" USING password;
    EXPORT TO "C:file1.txt" OF DEL MESSAGES "C:\file_error.txt" SELECT * FROM schema.tablename
    CONNECT RESET;

    CONNECT TO CAEEDMT USER "caeedm" USING password;
    DELETE FROM schema.tablename;
    IMPORT FROM "C:\file1.txt" OF DEL METHOD P (1, 2, 3) MESSAGES "C:\file_error.txt" INSERT INTO schema.tablename (ID, "NAME", DESCRIPTION);
    CONNECT RESET;

    CONNECT TO CAEEDMD USER "caeedm" USING password;
    DELETE FROM schema.tablename;
    IMPORT FROM "C:\file1.txt" OF DEL METHOD P (1, 2, 3) MESSAGES "C:\file_error.txt" INSERT INTO schema.tablename(ID, "NAME", DESCRIPTION);
    CONNECT RESET;


    this is the code for a single table .

    but I want to do this for a list of tables .
    The code should be in a loop

    I got the list of table. but can't process further.
    Last edited by super_mpk; 05-19-11 at 11:26.

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    First V8 has been out of service from IBM for a few years now. You should look into updating to the latest version (9.7). Read the manual for the db2move utility. It should do what you want.

    Andy

  5. #5
    Join Date
    May 2011
    Posts
    15
    Hi thanks for your valuable reply.

    Please will you tell me from where the db2move utility can run.

    I tried into command window, CLP , command Editor but It is giving error.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •