• savosin_sergey (12/7/2010)


    Yes, question is instrustive (for me), but BOL says:

    Caution:

    Any null values returned by subquery or expression that are compared to test_expression using IN or NOT IN return UNKNOWN. Using null values in together with IN or NOT IN can produce unexpected results

    So, results may be different! By the way, using Set ansi_nulls off, the result is three rows: "2, 3, 4"

    ANSI_NULLS settings are discussed every time null values are mentioned. If someone wants to make it a point of the question, they can add the "It depands" answer.

    Null values in negative comparisons are allways dangerous.



    See, understand, learn, try, use efficient
    © Dr.Plch