呵,同意楼上的~~~
select * from A where a is not null
set ansi_nulls off
select * from A where a is not null
select * from A where a <> null
及
select * from A where a is not null
set ansi_nulls on
select * from A where a is not null
select * from A where a <> null
进行比较!!
When set to ON, all comparisons to a null value evaluate to NULL (unknown). When set to OFF, comparisons of non-Unicode values to a null value evaluate to TRUE if both values are NULL. By default, the ANSI_NULLS database option is OFF.
这是一个技术讨论问题了!可以试试!!!!
但荐于数据库的默认值为on,所以考虑到这一点。为了让你的语句适用于所有的SQL Server。最好建议使用is not null!这样比较大众化!!!
呵,同意楼上的~~~
select * from A where a is not null
set ansi_nulls off
select * from A where a is not null
select * from A where a <> null
及
select * from A where a is not null
set ansi_nulls on
select * from A where a is not null
select * from A where a <> null
进行比较!!
When set to ON, all comparisons to a null value evaluate to NULL (unknown). When set to OFF, comparisons of non-Unicode values to a null value evaluate to TRUE if both values are NULL. By default, the ANSI_NULLS database option is OFF.