Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2008
    Posts
    3

    Unanswered: 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

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What DB2 version and OS?

    Andy

  3. #3
    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

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    That would be the RESTARTCOUNT option. It's amazing what you can find in the manual, isn't it?
    ---
    "It does not work" is not a valid problem statement.

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    There is also the SKIPCOUNT option which is equivalent to RESTARTCOUNT.

    Andy

  6. #6
    Join Date
    Jan 2008
    Posts
    3
    I used the skipcount - thanks for the info.

  7. #7
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  8. #8
    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 10:04.

  9. #9
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You mean any solutions other than the ones we posted already?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  10. #10
    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

Posting Permissions

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