Re: Unique Constraint with Multiple NULLS
Date: Thu, 8 Jan 2004 11:06:09 -0000
Message-ID: <GumdnaKLcYVrpWCiRVn-hQ_at_giganews.com>
Ouch, you're right. The definition you quoted is for the UNIQUE predicate. I wrongly thought that the UNIQUE *constraint* was formulated differently but it is in fact defined in terms of the predicate.
ISO/IEC 9075-2:2003 11.7 says:
3) If <unique column list> UCL is specified, then
...
c) Case:
i) If the <unique specification> specifies PRIMARY KEY, then let SC be the
<search condition>:
UNIQUE ( SELECT UCL FROM TN )
AND
( UCL ) IS NOT NULL
ii) Otherwise, let SC be the <search condition>:
UNIQUE ( SELECT UCL FROM TN )
...
2) The unique constraint is not satisfied if and only if EXISTS ( SELECT * FROM TN WHERE NOT ( SC ) ) is True.
Microsoft SQLServer exhibits the non-standard behaviour that I described and that's the root of the OP's problem - and the root of my confusion since SQLServer is what I work with.
Thanks for the correction.
-- David Portas ------------ Please reply only to the newsgroup --Received on Thu Jan 08 2004 - 12:06:09 CET