SET ANSI_NULLS ON/OFF

  • Hello there,

    I wonder why Stored Procedures in SQL Server always have SET ANSI_NULLS ON.

    I assume that whenever we create a Stored Procedure, it should have default setting of

    SET ANSI_NULLS OFF and not SET ANSI_NULLS ON.

    I that case, SP will always return expected result for conditions:

    WHERE column_name=NULL or

    WHERE column_name<>NULL.

    Can anyone guide with a logic for why ANSI_NULLS is ON by default?

    Thank you!

  • inuts (9/2/2009)


    Can anyone guide with a logic for why ANSI_NULLS is ON by default?

    Because it's the standard and it increases code portability. On top of that, it's easy to work with. Why would someone want to use something that is intentionally not standard when it's so easy to implement the same thing using standards?

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply