Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011

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

  2. #2
    Join Date
    Apr 2006
    Provided Answers: 11
    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
    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-V11 Fundamentals- DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified

  3. #3
    Join Date
    Oct 2011


    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.

Posting Permissions

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