• Tao Klerks

    The sentence "NULL does not equal NULL" is correct, when you have ANSI_NULLs on...

    On the other hand, the statement "Try comparing two NULL values in SQL - they will never be equal" is just wrong. Try this:

    SET ANSI_NULLS OFF

    IF Null = Null

    PRINT 'Oops, Null equals Null today!'

    Microsoft is going to eliminate ANSI_NULLS OFF with the next version of SQL Server. If they do it, then most of stored proc that compare table columns against variables may need to be rewritten because the variables may have NULL values

    --Example:

    --this statement will be nonfunctional if compiled with ANSI_NULLS ON:

    DECLARE @v-2 varchar(1) -- it may be parameter to stored proc sent with NULL value

    SELECT * FROM table where column = @v-2