This is just a small thing, but (A = B OR A IS NULL AND B IS NULL) is
not valid.  You need to write ((A = B AND A IS NOT NULL AND B IS NOT
NULL) OR (A IS NULL AND B IS NULL)).  Otherwise, it's not a boolean
expression and when you put a NOT in front, suddenly your "false" is
still "false".

On Wed, Apr 13, 2011 at 3:25 AM, Harald Mueller <[email protected]> wrote:
> (e) You want Linq (for whatever reasons). What is wrong with (A = B OR A IS 
> NULL AND B IS NULL)? It is reasonably easy to read, it is correct, it is 
> performant - at least on SQL Server (yes: I do not know what happens on other 
> databases), it uses the indices as you expect - no table scans (we transform 
> our pre-Linq expression language to it - so we know it; having used SQL 
> server 2000, 2005, 2008).

Reply via email to