ARRAY_LENGTH (Azure Cosmos DB)ARRAY_LENGTH (Azure Cosmos DB)
适用于:
SQL API
返回指定数组表达式的元素数。Returns the number of elements of the specified array expression.
语法Syntax
ARRAY_LENGTH(<arr_expr>)
参数Arguments
arr_exprarr_expr
是一个数组表达式。Is an array expression.
返回类型Return types
返回一个数值表达式。Returns a numeric expression.
示例Examples
以下示例演示了如何使用 ARRAY_LENGTH
获取数组的长度。The following example how to get the length of an array using ARRAY_LENGTH
.
SELECT ARRAY_LENGTH(["apples", "strawberries", "bananas"]) AS len
下面是结果集。Here is the result set.
[{"len": 3}]
备注Remarks
此系统函数不会使用索引。This system function will not utilize the index.