SQL Server,null 区分大小写吗?

问题描述 投票:0回答:2

我的一位同事表示,她有一个疑问,只有使用

NULL
才能“工作”,而不是使用
null

她无法给我提供例子。

据我所知应该没有任何区别,我什至进行了一个简单的测试:

select case when NULL is NULL then 1 else 0 end;

select case when NULL is null then 1 else 0 end;

select case when null is NULL then 1 else 0 end;

select case when null is null then 1 else 0 end;

正如所料,他们都回来了

1

所以这里的问题是,使用

null
与使用
NULL
不同吗?

sql-server-2005
2个回答
2
投票

也许她比较了字符串

'NULL'
'null'


1
投票

不,

Null
不区分大小写。
is NULL
is null
将始终产生相同的结果。

© www.soinside.com 2019 - 2024. All rights reserved.