RTrim Function

The RTrim() or Right Trim function removes all specified characters from the right-hand side of a string, it requires minimum of one (1) argument and maximum 2. Comparison is case sensitive If only one parameter is provided blank spaces are removed from right or end of string.

Syntax for LTrim() is LTrim( String , [ string to remove ] ) .

The [ string to remove ] will be removed from the end side of string. If second parameter is omitted, the ltrim function will remove all trailing spaces from string.

        SELECT RTRIM('    SQLDatabase.Net    ') /* returns    SQLDatabase.Net */ ;

SELECT RTRIM('SQLDatabase.Net', '.Net') /* returns SQLDatabase */ ;

SELECT RTRIM('SQLDatabase.Net', 'net') /* returns SQLDatabase.Net due to case mismatch */ ;

SELECT RTRIM('SQLDatabase.Net.Net.Net.Net', '.Net') /* returns SQLDatabase all ".Net" are trimed */ ;