Subject Re: Check and null values
Author a_broekhuis
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 07:00 AM 20/04/2005 +0000, you wrote:
>
>
> >Hi all,
> >
> >I'm trying to covert an old sqlanywhere database to firebird 1.5. The
> >current database schema uses several checks on colums.
> >
> >I have the following problem, if there is a check on a column to check
> >if a value is eg 1 or 2 and the column can have null values,
> >sqlanywhere seems to accept null values, while firebird does not.
> >Firebird wants to enforce the check, and discards the "can be null"
thing?
>
> No; but you have to specify NULL as an allowed option, viz.
>
> CHECK (TheValue is null or TheValue in (1,2)). Of course, this check
> constraint is not valid if the column TheValue is declared as NOT NULL.

Thanx for the info, so if I insert the null in all my checks I wont
have any conflicts between NOT NULL on the column and the NULL in the
check, and NOT NULL is always evaluated before the check? The erd tool
we use has globaly declared check constraints. So that would save me
some time editing the schema.

Alexander

Ps: Something different, and I do not know where to ask/mention. This
groep shows http://firebirdsql.org as website, that url doesn't work.
www.firebirdsql.org does.