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 > Problem with import from file command

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-19-11, 12:12
electrolite electrolite is offline
Registered User
 
Join Date: Oct 2011
Posts: 2
Problem with import from file command

Hello everyone!
I have a problem with the import command of db2.
I have a table called "customer" with 4 columns, A B C and D, and i want to import data from a file "file1.mdel", but in this file there are only B C and D columns. At the same time of the import command i want to set value of column A, for example with a default value "ONE". I can't use the Update command because i have another file "file2.mdel" and in this case I want to set column A with another value, for example "TWO".

I use DB2 9.5 and Windows xp. Sorry for my bad english and thanks!!

Ps: for now, without setting column A, the queries are:
IMPORT FROM c:\file1.mdel OF DEL INSERT INTO customer(B,C,D)
IMPORT FROM c:\file2.mdel OF DEL INSERT INTO customer(B,C,D)
Reply With Quote
  #2 (permalink)  
Old 10-19-11, 12:46
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
q1. if col is null =yes you can import and if you do not specify this col in the collist
q2. change the default value for this col to ONE - import1
change the default and import2
or import1 - update table set cola=one where cola is null
import2 - update table set cola=two where cola=one
__________________
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
  #3 (permalink)  
Old 10-20-11, 05:26
electrolite electrolite is offline
Registered User
 
Join Date: Oct 2011
Posts: 2
Resolved

Quote:
Originally Posted by przytula_guy View Post
update table set cola=one where cola is null
Thanks! This is exactly what I was looking for.
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