If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Create/ Export Table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-06-05, 00:19
Ann22 Ann22 is offline
Registered User
 
Join Date: Mar 2005
Posts: 23
Unhappy 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!

Reply With Quote
  #2 (permalink)  
Old 03-06-05, 01:35
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390

Last edited by Marcus_A; 03-06-05 at 01:40.
Reply With Quote
  #3 (permalink)  
Old 03-06-05, 10:27
Ann22 Ann22 is offline
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old 03-06-05, 12:19
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390

Last edited by Marcus_A; 03-06-05 at 12:26.
Reply With Quote
  #5 (permalink)  
Old 03-06-05, 16:52
Ann22 Ann22 is offline
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old 03-07-05, 13:54
Ann22 Ann22 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On