SQL server 中null的用法

在SQL中我们经常用到null值,

那么什么是NULL?如下是MSDN给出的一段简短描述(见“Null Values”):
•A value of NULL indicates that the value is unknown. A value of NULL is different from an empty or zero value. No two null values are equal. Comparisons between two null values, or between a NULL and any other value, return unknown because the value of each NULL is unknown.

也就是说,null指的是未知的,与空和0不通,2个null也不相等,即null不能用于比较运算,因此在SQL的条件中不能出现“字段=null”和“字段<>null”这种写法。

猜你喜欢

转载自www.cnblogs.com/lumingprince/p/8949879.html