IS_DEFINED (Azure Cosmos DB)

APPLIES TO: SQL API

Returns a Boolean indicating if the property has been assigned a value.

Syntax

IS_DEFINED(<expr>)  

Arguments

expr
Is any expression.

Return types

Returns a Boolean expression.

Examples

The following example checks for the presence of a property within the specified JSON document. The first returns true since "a" is present, but the second returns false since "b" is absent.

SELECT IS_DEFINED({ "a" : 5 }.a) AS isDefined1, IS_DEFINED({ "a" : 5 }.b) AS isDefined2 

Here is the result set.

[{"isDefined1":true,"isDefined2":false}]  

Remarks

This system function will benefit from a range index.

Next steps