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 > Import

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-30-06, 14:40
redwolf redwolf is offline
Registered User
 
Join Date: Apr 2004
Posts: 179
Import

Is there a way to tell the db2 import utility to skip the last row in an input file?

85I Instance "db2inst1" uses "32" bits and DB2 code release "SQL08022"
with level identifier "03030106".
Informational tokens are "DB2 v8.1.0.89", "special_15295", "U800790_15295", and
FixPak "9".
Product is installed at "/opt/IBM/db2/V8.1".
Reply With Quote
  #2 (permalink)  
Old 08-30-06, 15:43
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
You could use standard unix tools (like "wc -l" and "head -'n'") to pipe all but the last line of that file to a named pipe, then call the "load" or "import" utility with the filename of the named pipe in the FROM clause.
Something like:
Code:
head -$(tail +2 FILE|wc -l) FILE > /tmp/named_pipe & \
db2 import from /tmp/named_pipe of del insert into my_table
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
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