RIGHT

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the last n characters from a string.

Syntax

right(<string>, <n>)

Arguments

Required

  • <string>: The source string.
  • <n>: The number of characters to return. When negative, returns all but the first |n| characters.

Returns

Returns a text value that contains the rightmost characters.

Considerations

  • If <n> exceeds the length of the string, returns the entire string.

Examples

Get Last Characters

Extract the last two characters.

SELECT right('abcde', 2) AS result;

Returns 'de'.

Related Documentation