The following query returns the result 'TURNERyxX'. RTRIM removes the individual occurrences of 'x' and 'y', and stops removing characters at 'X', because 'X' is not in the expr2 argument.
SELECT RTRIM('TURNERyxXxy,'xy');
The following query returns the result ' RIGHTT TRIM', because the leading spaces are not removed, and stops removing characters at 'M', because 'M' is not in the expr2 argument. Because the expr2 argument is not explicitly specified, the default of a single space is used.
SELECT RTRIM(' RIGHTT TRIM ');
The following query returns the result ' RIGHTT TRIM', because the leading spaces are not removed, and stops removing characters at 'M', because 'M' is not in the expr2 argument. Because the expr2 argument is not explicitly specified, the default of a single space is used.
SELECT RTRIM(' RIGHTT TRIM ');