LEFT (Azure Cosmos DB)LEFT (Azure Cosmos DB)
适用于:
SQL API
返回具有指定字符数的字符串的左侧部分。Returns the left part of a string with the specified number of characters.
语法Syntax
LEFT(<str_expr>, <num_expr>)
参数Arguments
str_exprstr_expr
要从中提取字符的字符串表达式。Is the string expression to extract characters from.
num_exprnum_expr
是指定字符数的数值表达式。Is a numeric expression which specifies the number of characters.
返回类型Return types
返回一个字符串表达式。Returns a string expression.
示例Examples
以下示例根据不同的长度值返回“abc”的左侧部分。The following example returns the left part of "abc" for various length values.
SELECT LEFT("abc", 1) AS l1, LEFT("abc", 2) AS l2
下面是结果集。Here is the result set.
[{"l1": "a", "l2": "ab"}]
备注Remarks
此系统函数将从范围索引中获益。This system function will benefit from a range index.