I've been searching the net for some answer to this. but all I get is the simple answers.
I have a few columns in my database that should have a constraint on their maximum value but not if another column is set to false
eg. I have the following values in the table
ROW ValueA TRUE/FALSE ValueB
0 3750 TRUE 0
1 5000 TRUE 0
2 5000 FALSE 0 [INITIAL VALUES PROVIDED]
2 3750 FALSE 1250 [ACTUAL VALUES ACCEPTED]
In this table Row2 is being provided by an external program, where ValueA is initially 5000, however the value for that row is set to FALSE, therefore it will limit the value to 3750 and add 1250 to ValueB
Now the idea is, that if set to true, it can bypass the check. but if it's set to false for that row and the value is bigger than 3750it should reduce ValueA back to 3750 and put the remainder in ValueB.
Is this possible to do with a Constraint Check expression, or would it be more prudent to use a Before Update trigger on this?