I have the following unique constraint
dup_Checklist_QNum UNIQUE (QUESTION_NO, IS_ACTIVE)
I am trying to prevent two questions having the same question number while being active (IS_ACTIVE value = 1).
All seemed fine until I had to rev a question for the second time.
QUESTION_NO=1, TEXT="Have you..", REV=1, IS_ACTIVE=0
QUESTION_NO=1, TEXT="Have you..", REV=2, IS_ACTIVE=0 <-- This should be ok but constraint was violated
QUESTION_NO=1, TEXT="Have you..", REV=3, IS_ACTIVE=1
QUESTION_NO=1, TEXT="Have you..", REV=3, IS_ACTIVE=1 <-- This should be throw constraint exception
I need the constraint to only apply when IS_ACTIVE=1