T-SQL Tutorial

T-SQL RTRIM string Function


T-SQL RTRIM function is an string function - delete spaces from the end (right) of the string.

RTRIM Syntax:

RTRIM ( string_expression );

RTRIM Example:

DECLARE @mystring varchar(250);
SET @mystring = 'Test RTRIM function - delete spaces from the beginning of my string.       ';
SELECT RTRIM(@mystring);
GO

Result
Test RTRIM function - delete spaces from the beginning of my string.

See also: T-SQL Functions -> Substring | Right | Upper | Left | LTRIM