Returns a sub string that is the right most part of the string, with the specified max length.
Parameters:
varchar
or nvarchar
, except for text
or ntext
bigint
max value (9,223,372,036,854,775,807).
If the max length parameter is negative, an error will be raised.SELECT RIGHT('This is my string', 6) -- returns 'string'
If the max length is more then the number of characters in the string, the entier string is returned.
SELECT RIGHT('This is my string', 50) -- returns 'This is my string'