In SQL Server, what does “SET ANSI_NULLS ON” mean?

前端 未结 7 2230
执念已碎
执念已碎 2020-11-27 13:22

The definition says:

When SET ANSI_NULLS is ON, a SELECT statement that uses WHERE column_name = NULL returns zero rows even if there are null values

7条回答
  •  一整个雨季
    2020-11-27 14:12

    I guess the main thing here is:

    Never user:

    • @anything = NULL
    • @anything <> NULL
    • @anything != null

    Always use:

    • @anything IS NULL
    • @anything IS NOT NULL

提交回复
热议问题