Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006

    Question Unanswered: Export and Import from SQL

    Hi all

    I'm brand new to DB2 as I've always used SQL Server. My company has just released a DB2 SQL script to the client that they're having trouble running due to performance issues. The script keeps running for 2+ hours before they cancel it.

    The issue appears to be on a update with a subquery running against a temp table while the live table is dropped and recreated with different columns. The guy who wrote it is unavailable to help but suggested that I change the script to export the information to an external file instead of a temp table before changing the live table and importing back in again.

    How do you do this? I have no idea how to export data to a csv or txt file from SQL. Any tips or pointers would be greatly appreciated.

    I'm using DB2 v8.1.0.36 on Windows 2000 server if it makes a diffference.

    Thanks for your help

  2. #2
    Join Date
    Feb 2006
    Utrecht, Netherlands

    Export - Example

    You can always check the syntax:
    db2 ? export
    but if you like a simple example, here it is:
    db2 export to MyFile.ixf of ixf select * from MyTable
    db2 export to MyOtherFile.del of del select * from MyOtherTable

    The extension is not mandatory; it serves as a reminder of what you have done.

  3. #3
    Join Date
    Feb 2006


    Thanks Rob! That looks like just the thing.

Posting Permissions

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