• I agree with axeld1980.

    The statements made about setting a value to null rather than just not setting it are incorrect. It makes absolutely no difference whether the value is assigned to null or not.

    The results you get are wholly dependent on the value for ANSI_NULLS. With this set to ON, nothing will ever '= NULL', not even if it is set explicitly. With the setting OFF, both '= NULL' and 'IS NULL' behave in the same way. So:


    SET ANSI_NULLS [ON|OFF]

    DECLARE @val CHAR(4)

    If @val = NULL

        print 'True'

    else

        print 'False'

    SET @val = NULL

     

    If @val = NULL

        print 'True'

    else

        print 'False'


    When 'ON', both tests return 'False'. When 'OFF', both tests return 'True'.

    This is the case for both SQL 7 and 2000. Try it for yourselves!