IS_NULL (Azure Cosmos DB)IS_NULL (Azure Cosmos DB)

返回一个布尔值,指示指定表达式的类型是否为 null。Returns a Boolean value indicating if the type of the specified expression is null.

语法Syntax

IS_NULL(<expr>)  

参数Arguments

exprexpr
是任何表达式。Is any expression.

返回类型Return types

返回一个布尔表达式。Returns a Boolean expression.

示例Examples

以下示例使用 IS_NULL 函数检查 JSON 布尔、数字、字符串、null、对象、数组和 undefined 类型的对象。The following example checks objects of JSON Boolean, number, string, null, object, array, and undefined types using the IS_NULL function.

SELECT   
    IS_NULL(true) AS isNull1,   
    IS_NULL(1) AS isNull2,  
    IS_NULL("value") AS isNull3,   
    IS_NULL(null) AS isNull4,  
    IS_NULL({prop: "value"}) AS isNull5,   
    IS_NULL([1, 2, 3]) AS isNull6,  
    IS_NULL({prop: "value"}.prop2) AS isNull7  

下面是结果集。Here is the result set.

[{"isNull1":false,"isNull2":false,"isNull3":false,"isNull4":true,"isNull5":false,"isNull6":false,"isNull7":false}]

备注Remarks

此系统函数将从范围索引中获益。This system function will benefit from a range index.

后续步骤Next steps