Unique constraint for the columns does not work when one of values is null.

Unique constraint for the columns does not work when one of values is null.

am 14.09.2007 12:55:13 von puginews

I have a table with a unique constraint on two integer columns.
Works fine, but one of the two columns can be null and then the
constraint does not work.
1 2 : OK
1 3 : OK
1 2 : error
2 null : OK
2 null : OK -> I want this to result in an error

Pugi!

Re: Unique constraint for the columns does not work when one of values is null.

am 14.09.2007 17:11:48 von Captain Paralytic

On 14 Sep, 11:55, Pugi! wrote:
> I have a table with a unique constraint on two integer columns.
> Works fine, but one of the two columns can be null and then the
> constraint does not work.
> 1 2 : OK
> 1 3 : OK
> 1 2 : error
> 2 null : OK
> 2 null : OK -> I want this to result in an error
>
> Pugi!

Do not multi-post. Cross-post if you must but don't multi post It
wastes
people's time. http://www.blakjak.demon.co.uk/mul_crss.htm