Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    23

    Unhappy Unanswered: Create/ Export Table

    Hi everyone!

    My first DB2 project. Please help!


    DB2 version 8.2 on AIX

    1. How do I save the result table as a new table?
    2. How to export the result table as text/excell file?

    I used the following statment:
    Code:
     EXPORT TO table_1 OF DEL SELECT * ......
    don't know where to specify the drive (c/my documents....)


    REALLY APPRECIATE YOUR HELP!


  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    DB2 manuals can be downloaded in PDF format. Check the "Useful DB2 Stuff" thread for the link. You want the Command Reference manual for using the EXPORT command.

    If you are connected to DB2 on AIX through a DB2 Command Window then you can export the file to your client workstation. You can also use the GUI interface (DB2 Control Center) on your windows client (if you installed the administrative or development client, both of which are free). If you have a telnet session into AIX, the file will be saved on an AIX directory.

    But to briefly answer your questions:

    1. Export in IXF format and then do an import.

    2. Use DEL and specify the delimiter you want (which will not be duplicated in any of the data).
    Last edited by Marcus_A; 03-06-05 at 02:40.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Mar 2005
    Posts
    23
    Thank you Marcus A.
    I figure out how to load the data into the table via GUI.

    ================================================== ========

    How do I export the result query into the non-delimited ASCII file and specify the export location?

    Here is my export statement:

    Code:
    EXPORT TO testexp  OF DEL 
    SELECT EARN, HRS
    FROM BASYS.ACT_VAL_04  
    FETCH FIRST 500 ROWS ONLY
    EXPORT TO testexp OF DEL SELECT EARN, HRS FROM BASYS.ACT_VAL_04 FETCH FIRST 500 ROWS ONLY

    Results:
    SQL3104N The Export utility is beginning to export data to file "testexp".
    SQL3105N The Export utility has finished exporting "500" rows.
    Number of rows exported: 500

    Where on AIX dir the file is located?

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    If you issued the command from an AIX telnet (or ssh, etc) session, the file will be located on the directory path where you submitted the command.

    If you issued it from a windows client, in a CLI command window (with the database catalogued as a remote database), it will be on the directory path of the windows client were you issued the issued the command. If you can't find the file, just use the windows find GUI since you know the file name is testexp.

    If you used the CLP, try c:\program files\SQLLIB\bin

    Most people use the DB2 command window and just preface everything with "db2", but you often have to put double quotes around the command string following the db2 command.
    Last edited by Marcus_A; 03-06-05 at 13:26.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  5. #5
    Join Date
    Mar 2005
    Posts
    23

    Unhappy

    Thank you M. A. Feldman!
    I tried to look for the file with windows GUI, and used CLP to export the data.
    Still was not able to locate the file.

  6. #6
    Join Date
    Mar 2005
    Posts
    23

    Talking

    Thanks everone for help
    Here is the statment on how to export the result tbl:

    export to "c:\temp\qtrfile.IXF" of del modified by nochardel decplusblank striplzeros

Posting Permissions

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