RTRIM

Use RTRIM to trim, or eliminate, the trailing spaces of a character string or to trim specific characters from a string.

The first parameter is the string property or value to trim. A second optional parameter, the trim string, is the character or characters to trim from the right of the string. If the second parameter is omitted, trailing spaces are trimmed from the right side of the string.

The trim string characters do not have to be in pattern order; each character is trimmed individually. Supported trim string characters are 0-9, a-z, A-Z, spaces, and select special characters. Not all special characters are supported.

Syntax

RTRIM(stringproperty)
RTRIM(stringproperty, trim_string)

Example

SELECT RTRIM('Baseball   '), RTRIM('Baseball-2020','-20')

Result: Baseball, Baseball