Valid column values in conjunction with default value

UDA
Enthusiast

Valid column values in conjunction with default value

Can you put a default value on a column as well as a list of "valid values"?
2 REPLIES
Enthusiast

Re: Valid column values in conjunction with default value

Yes, like this:

create table xxxx
(col1 char(1) default 'Y' check (col1 in ('Y','N'))...

You can even have a multi-column rule, although I believe these must be defined after the definition of the columns (similar to where RI constraints would be in the statement).

Enthusiast

Re: Valid column values in conjunction with default value

Thank you so much!