Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2015

    Unanswered: Db2 Import command


    i have a requirement, where i need to insert records, delete and update operations based on few columns. We get data in csv format like shown below.

    UserId, userEmail, Name, delete
    1,"", "Dummy", "Y"
    2."", "lName", "N"

    1. Need to insert operation on target table if user id is not present.
    2. Need to update on target table if user id present and delete ="N".
    3. Need to delete on target table if user id present and delete ="Y"

    I am not sure whether we can achieve this with db2 import. Could someone help me ?

  2. #2
    Join Date
    Jul 2016
    Provided Answers: 10

    INGEST with MERGE should help you.
    If you are not able to use INGEST, you can use IMPORT, but you have to implement the UPDATE/DELETE logic with an AFTER UPDATE trigger on your table or create a view with an INSTEAD OF UPDATE trigger on it and use this view in your IMPORT command.

Posting Permissions

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