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 > Loading Data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-29-09, 07:36
shahnazurs shahnazurs is offline
Registered User
 
Join Date: May 2005
Posts: 25
Loading Data

Can someone tell me how to load data from excel sheet to db2 table? Is there any way if I use , (comma) as delimiter to load only particular fields into the table rather than all fields.


Thanks.
Reply With Quote
  #2 (permalink)  
Old 09-29-09, 08:46
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
how about, looking in the doc at
IMPORT
or at the same place, look for load command and format parameter
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 09-29-09, 17:21
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by shahnazurs
Can someone tell me how to load data from excel sheet to db2 table? Is there any way if I use , (comma) as delimiter to load only particular fields into the table rather than all fields.
The answer depends on the version and platform where you run DB2.
For DB2 v8 and v9 on z/OS, use the following to load a CSV file with three columns (of types CHAR, DATE, and INTEGER) into a table with column names col1, col2 and col3 (with possibly more than these three columns):
Code:
LOAD DATA FORMAT delimited INTO TABLE mytablename
(col1 CHAR, col2 DATE EXTERNAL, col3 INT EXTERNAL)
Make sure that the non-numerical CSV fields in the file (in my example: columns 1 and 2) are quoted with double quotes.
If you want to skip some fields, you cannot use CSV but you have to use fixed-position fields instead. In that case, just specify the column names you need (and their starting position on each line in the file) between the parentheses.
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/

Last edited by Peter.Vanroose; 09-29-09 at 17:32.
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