• Good question.

    My hangover produced the wrong answer (blame isNull); must remember to drink fruit-juice and coffee before looking at QoTD the morning after a long, late, and liquid celebration. Kicked myself on seeing the answer - isNull is always eliminable by elemetary logic!

    P(isNull(A, B)) == (A is Null and P(B*)) or (P(A) and not (A is Null))

    (B* is either B or cast(B as A), depending on whether B and A have the same type or not)

    for every predicate P. So unless either A or B is unsargable or getting B to the type of A involves the type conversion of a column (which it clearly doesn't when B is a constant) isNull(A,B) ought to be sargable.

    edit: But it isn't sargable. I'm feeling stupid. :blush:

    Tom