Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    14

    Unanswered: DB2 IMPORT for Custom SQL

    I want to use my custom SQL in the DB2 Import statement.
    like
    IMPORT from c:\tmp\a.txt of DEL modified by coldel| method N(password, loginId) messages c:\tmp\b.txt insert_update into tableA set password = password where colA = (select colA from tableB where loginID = logid).

    Here password and logid are the values which i read from the flat file a.txt and update tableA based on the above where condition. Can I achieve using DB2 Import command or similar DB2 utilies?

    I have already written a java program which does this. But I would prefer a built in DB2 tool which will do this for me.

    THanks,
    Gopal

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Gopal,

    According to the UDB 7.x,8.1 manuals, the answer is no. You can only specify which table and which columns to import--same with the LOAD utility.

    Andy

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: DB2 IMPORT for Custom SQL

    You have to be aware that the IMPORT with INSERRT_UPDATE option works based on the primary key ...

    Eg:
    for a table with columns, custid, custpwd , with custid as the primary key, then the input file

    cust1,pass
    cust2,pass

    when inser_updated into the table will check for a row with custid cust1. If it exisits, the password is updated, else a new row is created with the custid, password combination

    HTH

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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