Results 1 to 2 of 2

Thread: DB2 Defaults

  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Unanswered: DB2 Defaults

    I'm new but I want to get a simple answer I can't seem to find.

    there are two columns in my table that relate to one another.
    when the table is built column A default is "N" Boolean or String value.
    Column B is default 0 smallint value.

    Now if when loading the table or updating it; the value in Column A changes; say to "Y" (as the values for this field are only Y and N) want the default to change to 99.

    That is if a Y is imported into column A i can't have a default of 0 the default has to be 99, but a different number could be imported other than say 66.

    but I'm not sure how to accomplish this outcome.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Try a BEFORE Trigger.

    Andy

Tags for this Thread

Posting Permissions

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