Results 1 to 4 of 4
  1. #1
    Join Date
    May 2011
    Posts
    5

    Unanswered: load from file to table and skip few records

    Hi Gurus,

    We use below statement to load file records into the table. Now my question is, can I skip few records in the file.

    load from /file_outbound/db2load_pipe of ASC METHOD L (1 2, 3 4, 5 15)
    MESSAGES /file_outbound/db2load_pipe.MESG
    REPLACE INTO SCHEMA_NAME.ERROR_MESSAGES(JOB_ID, ROW_ID, ERROR_MESSAGE)
    NONRECOVERABLE

    For eg:

    If we have data in the file

    10 1TRUEESCRIPTION
    10 2FALSEESCRIPTION
    10 3FALSEESCRIPTION
    10 4TRUEESCRIPTION
    10 5TRUEESCRIPTION

    I'd like the table to have records with TRUE starting in position 5. Need to skip records with value FALSE.

    Table should have
    COL1 COL2 COL3
    10 1 TRUEESCRIPTION
    10 4 TRUEESCRIPTION
    10 5 TRUEESCRIPTION

    Is this possible?

    Thnx
    MMe

  2. #2
    Join Date
    May 2011
    Posts
    5

    Load file to table and skip some records

    Any help would be helpful...

  3. #3
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    no with load/import this can not be done
    you should use an application to insert the data
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    A couple of possible options:
    - use an OS tool (sed, awk, and perl come to mind) to filter data prior to loading;
    - load everything into a staging table, then define a cursor that selects only the data you need and use it to load the target table

Posting Permissions

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