• Paul White NZ (5/3/2010)


    Hugo Kornelis (5/3/2010)


    Using ISNULL can work around this - although the result is admittedly not trivial to understand:

    AND NULLIF(Column1, Column2) IS NULL

    AND NULLIF(Column2, Column1) IS NULL

    :w00t: Hugo!!! Yuk! :sick:

    Think I have to go with Paul on this one. For me,

    WHERE Column18 > 27

    AND (Column1 = Column2 OR (Column1 IS NULL AND Column2 IS NULL))

    is easier to write, to read, and to understand quickly (and should perform as well or better) than:

    WHERE Column18 > 27

    AND NULLIF(Column1, Column2) IS NULL

    AND NULLIF(Column2, Column1) IS NULL

    So I don't see any value to NULLIF in this scenario.

    As for me, I read the question, understood the logic, did the process, decided on NULL, then clicked on 0. Steve, when are you going to get that module that scores us on what we meant to choose, rather than what we actually chose...? 😛