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 from file to table and skip few records

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-20-11, 16:27
mme mme is offline
Registered User
 
Join Date: May 2011
Posts: 5
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
Reply With Quote
  #2 (permalink)  
Old 09-20-11, 23:58
mme mme is offline
Registered User
 
Join Date: May 2011
Posts: 5
Load file to table and skip some records

Any help would be helpful...
Reply With Quote
  #3 (permalink)  
Old 09-21-11, 02:16
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #4 (permalink)  
Old 09-21-11, 08:15
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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
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