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 > load file, skip the header rec

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-23-08, 10:08
joej8810 joej8810 is offline
Registered User
 
Join Date: Jan 2008
Posts: 3
load file, skip the header rec

I am trying to load a file into a db2 database using the following command:

import from ${InputFile} of del
modified by coldel|
commitcount 100
insert into ${WORK_SCHEMA}.${CSI_LOAD_TBL};

There is a header row that I want to skip. Does DB2 have commands that can be used to skip the 1st record in the file?

thanks,

Joe
Reply With Quote
  #2 (permalink)  
Old 01-23-08, 10:43
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What DB2 version and OS?

Andy
Reply With Quote
  #3 (permalink)  
Old 01-23-08, 10:49
joej8810 joej8810 is offline
Registered User
 
Join Date: Jan 2008
Posts: 3
Quote:
Originally Posted by ARWinner
What DB2 version and OS?

Andy

I am using AIX and Command Line Processor for DB2 SDK 8.2.5
Reply With Quote
  #4 (permalink)  
Old 01-23-08, 10:49
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
That would be the RESTARTCOUNT option. It's amazing what you can find in the manual, isn't it?
Reply With Quote
  #5 (permalink)  
Old 01-23-08, 10:55
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
There is also the SKIPCOUNT option which is equivalent to RESTARTCOUNT.

Andy
Reply With Quote
  #6 (permalink)  
Old 01-23-08, 11:22
joej8810 joej8810 is offline
Registered User
 
Join Date: Jan 2008
Posts: 3
I used the skipcount - thanks for the info.
Reply With Quote
  #7 (permalink)  
Old 01-23-08, 11:32
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Alternatively, it would be possible to load from a pipe. Then you could send the file into the pipe, dropping the first line in the process. Lot's of solutions...
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #8 (permalink)  
Old 12-08-08, 08:58
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
i m having files already with header info and i want to use Load not import. Can't find equivalent modifier for SKIPCOUNT for LOAD. Any Hints?
following link says i have to edit the file and proceed..
http://publib.boulder.ibm.com/infoce...g/amarcsv0.htm

Last edited by rahul_s80; 12-08-08 at 09:04.
Reply With Quote
  #9 (permalink)  
Old 12-08-08, 12:56
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You mean any solutions other than the ones we posted already?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #10 (permalink)  
Old 12-09-08, 09:20
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
Quote:
Originally Posted by rahul_s80
i m having files already with header info and i want to use Load not import. Can't find equivalent modifier for SKIPCOUNT for LOAD. Any Hints?
following link says i have to edit the file and proceed..
http://publib.boulder.ibm.com/infoce...g/amarcsv0.htm

In this case you have 2 options -
1. Open the file in a text editor and delete the column names ( I presume your file is in CSV format) and then run LOAD command
2. Or else run the load command and hope that the first row gets caught in your exception table which you define.


Moreover I believe you can go ahead with IMPORT command as only your loading times will be slower... but then it again depends upon the amount of data you are about to INSERT into the new table. WHat is the rowcount that you are looking to insert?
__________________
IBM Certified Database Associate, DB2 9 for LUW
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