I have a varchar column, called weather
, I would like to validate its values.
The allowed values are from enum. As opposed to a regular enum column- where each time one of the enum values is allowd, this column allows several enum members, separated with a comma.
This is how I validate a simple enum column:
select *
from TableName
where weather not in ('SUN', 'RAIN', 'SNOW');
The weather
contains SUN
or RAIN
or SNOW
.
What if the weather
contains SNOW,RAIN
or RAIN,SNOW
?
how can I validate there are only values from enum then?
Any ides? thoughts?