t-sql where = null 意思

t-sql Where = null meaning

我知道这是对的:

select * from GoodmanLeads where Lastname is null

我知道这是错误的:

select * from GoodmanLeads where Lastname = null

但它没有抱怨。不给出语法错误。只是不产生任何行。

它在t-sql中是否有一些可能很多人不知道的含义?

null 是一种 undefined/unknown 值,所以你不能真正比较未定义和未定义。在这种情况下,IS 将专门处理此问题,而 = 将被视为常规相等比较。

Null 是未知值,不是 0。因此,未知值永远不等于其他未知值。只是 Null 不等于 Null。这样 Lastname = null returns false always