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 > Export and Import from SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-28-06, 04:12
PhillyMe PhillyMe is offline
Registered User
 
Join Date: Feb 2006
Posts: 2
Question 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
P
Reply With Quote
  #2 (permalink)  
Old 02-28-06, 08:20
Rob den Heijer Rob den Heijer is offline
Registered User
 
Join Date: Feb 2006
Location: Utrecht, Netherlands
Posts: 16
Export - Example

Hi,
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
or
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.
cheers,
Rob.
Reply With Quote
  #3 (permalink)  
Old 02-28-06, 09:00
PhillyMe PhillyMe is offline
Registered User
 
Join Date: Feb 2006
Posts: 2
Talking

Thanks Rob! That looks like just the thing.
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