RIGHT (Azure Cosmos DB)

Returns the right part of a string with the specified number of characters.

Syntax

RIGHT(<str_expr>, <num_expr>)  

Arguments

str_expr
Is the string expression to extract characters from.

num_expr
Is a numeric expression which specifies the number of characters.

Return types

Returns a string expression.

Examples

The following example returns the right part of "abc" for various length values.

SELECT RIGHT("abc", 1) AS r1, RIGHT("abc", 2) AS r2 

Here is the result set.

[{"r1": "c", "r2": "bc"}]  

Remarks

This system function will not utilize the index.

Next steps