LEFT (NoSQL query)
APPLIES TO: NoSQL
Returns the left part of a string up to the specified number of characters.
Syntax
LEFT(<string_expr>, <numeric_expr>)
Arguments
Description | |
---|---|
string_expr |
A string expression. |
numeric_expr |
A numeric expression specifying the number of characters to extract from string_expr . |
Return types
Returns a string expression.
Examples
The following example returns the left part of the string AdventureWorks
for various length values.
SELECT VALUE {
firstZero: LEFT("AdventureWorks", 0),
firstOne: LEFT("AdventureWorks", 1),
firstFive: LEFT("AdventureWorks", 5),
fullLength: LEFT("AdventureWorks", LENGTH("AdventureWorks")),
beyondMaxLength: LEFT("AdventureWorks", 100)
}
[
{
"firstZero": "",
"firstOne": "A",
"firstFive": "Adven",
"fullLength": "AdventureWorks",
"beyondMaxLength": "AdventureWorks"
}
]
Remarks
- This function benefits from a range index.