Subject | RE: [Firebird-Java] Int field restriction |
---|---|
Author | Steffen Heil |
Post date | 2007-07-19T17:03:11Z |
Hi
How about creating a computed column that is equal to the original column
except that it is NULL if the original is 0.
Contraining that to be UNIQUE.....
Regards,
Stefefn
[Non-text portions of this message have been removed]
> > I need make a restriction, at database level, where I canJust an untested idea...
> permit only the number 0 (zero) repeat. Numbers greater than
> 0 can't repeat.
>
> Would the NULL value fit your purposes? If you define the
> unique constraint, the rows with NULLs don't count, only the
> rows with values.
> Note that you can create another computed column which would
> have value of 0 if the original column is NULL. Also you can
> create index on computed column, so searches would be also fast.
>
> However it won't work if you must have NULL and 0s...
How about creating a computed column that is equal to the original column
except that it is NULL if the original is 0.
Contraining that to be UNIQUE.....
Regards,
Stefefn
[Non-text portions of this message have been removed]