Search code examples
db2export-to-csvdb2-luw

Exporting result of multiple select statement with db2 export command?


Is it possible to export result of multiple select statement with db2 "export" command ( https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0008303.html ) like db2 command line processor (ie db2 -tvf file.sql with many sql request in file.sql) ?

Best regards


Solution

  • Do you mean like this?

    $ cat export
    export to f1 of del values 1;
    export to f2 of del values 2;
    
    $ db2 -tf export
    SQL3104N  The Export utility is beginning to export data to file "f1".
    
    SQL3105N  The Export utility has finished exporting "1" rows.
    
    
    Number of rows exported: 1
    
    
    SQL3104N  The Export utility is beginning to export data to file "f2".
    
    SQL3105N  The Export utility has finished exporting "1" rows.
    
    
    Number of rows exported: 1