Hello,
If a column has a check constraint of TYPEX IN ('Y', 'N'), then only Y and N values are allowed and other receive a constraint violation error message.
However, I have a table where the specified the constraints to be: TYPEX IN (NULL, 'Y', 'N').
What the NULL value appears to act as a wildcard and lets anything value ('y', 'Y', '1', 'K'...) be put into the column.
So my question is:
1. Is this a little known "feature" and we need to rethink how to use those columns without a NULL value?
2. Is there another way to specify the check constraint to permit a NULL value be in the list of allowable values?
Thanks,
Michael42
If a column has a check constraint of TYPEX IN ('Y', 'N'), then only Y and N values are allowed and other receive a constraint violation error message.
However, I have a table where the specified the constraints to be: TYPEX IN (NULL, 'Y', 'N').
What the NULL value appears to act as a wildcard and lets anything value ('y', 'Y', '1', 'K'...) be put into the column.
So my question is:
1. Is this a little known "feature" and we need to rethink how to use those columns without a NULL value?
2. Is there another way to specify the check constraint to permit a NULL value be in the list of allowable values?
Thanks,
Michael42