I have a table with 2 columns (A as bool and B as text), these columns can be:
- both are null
- if A is False, then B should be null
- if A is True, then B should be not null
There are rules. I want to create a stored procedure or function to check these rules when row adding or updating (via trigger). What is better, stored procedure or function? If function, which type? In general, which variant is the best (return boolean or other way etc)?
I think you’re after a
CHECKConstraint.Example: