RIGHT (NoSQL query)
APPLIES TO: NoSQL
Returns the right part of a string up to the specified number of characters.
Syntax
RIGHT(<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 right part of the string Microsoft
for various length values.
SELECT VALUE {
lastZero: RIGHT("AdventureWorks", 0),
lastOne: RIGHT("AdventureWorks", 1),
lastFive: RIGHT("AdventureWorks", 5),
fullLength: RIGHT("AdventureWorks", LENGTH("AdventureWorks")),
beyondMaxLength: RIGHT("AdventureWorks", 100)
}
[
{
"lastZero": "",
"lastOne": "s",
"lastFive": "Works",
"fullLength": "AdventureWorks",
"beyondMaxLength": "AdventureWorks"
}
]
Remarks
- This function benefits from a range index.