Eliminate trailing spaces from a string.
SELECT RTRIM(‘SQL Tutorial ‘) AS RightTrimmedString; |
The RTRIM() function removes trailing spaces from a string. while the LTRIM() function removes leading spaces.
RTRIM(string) |
Parameter |
Description |
string |
Required: The string from which trailing spaces should be removed. |
Works in: |
SQL Server (starting from 2008), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse. |