Results 1 to 3 of 3

Thread: Command EXPORT

  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: Command EXPORT

    Hallo everyone,

    in order to keep my db2 file systems low, I am using the command EXPORT in my sql-script, which I run with unix script:

    Code:
    connect to my_connection;
    
    export to ./myfile.csv of del
    
    select * from mySchema.table_01;
    
    disconnect my_connection

    The code above works fine. But actually, I would like to fill the .csv-file with records from 2 tables. In order to do so, I did these codes, but unfortunately they didnt work:

    Code:
    connect to my connection;
    
    export to ./myfile.csv of del
    
    select * from mySchema.table_01;
    
    export to ./myfile.csv of del
    
    select * from mySchema.table_02;
    
    disconnect my_connection;
    This one obviously doenst work:
    Code:
    connect to my connection;
    
    export to ./myfile.csv of del
    
    select * from mySchema.table_01
    
    select * from mySchema.table_02;
    
    disconnect my_connection;
    Does someone have an idea to do so? Thank you.

    Regards,
    Ratna

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    If both tables have the same structure, you can use the UNION operator, othewise you'd have to export into separate files and concatenate them using your operating system command.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    May 2012
    Posts
    155
    thank you for the tipp, n_i

Posting Permissions

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