RTRIM function in SQL Server
The RTRIM function in SQL Server is used to delete all space characters from the last position (the right positions) of the string.
The article will learn and show you how to use the RTRIM function in SQL Server to delete all space characters from the right positions of the string.
Describe
The RTRIM function in SQL Server is used to delete all space characters from the last position (the right positions) of the string.
Syntax
To use the RTRIM function in SQL Server, we use the following syntax:
RTRIM(chuoi)
Parameters :
- string : the string you want to cut space characters from the right side. This string must be a character expression or binary data. It can be a string, variable or column.
Note :
- See also LTRIM function with the same function but on the right side.
- RTRIM function can be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, and SQL Server 2005.
For example
Take a look and explore some examples of RTRIM functions in SQL Server.
SELECT RTRIM('TipsMake.com ');
Result: 'TipsMake.com'
SELECT RTRIM(' TipsMake.com ');
Result: ' TipsMake.com'
SELECT RTRIM('Quan Tri Mang ');
Result: 'Quan Tri Mang'
Previous article: Function RIGHT in SQL Server
Next lesson: SPACE function in SQL Server
4 ★ | 2 Vote
You should read it
- ABS function in SQL Server
- DAY function in SQL Server
- MIN function in SQL Server
- MAX function in SQL Server
- SUM function in SQL Server
- ROUND function in SQL Server
- MONTH function in SQL Server
- DATEDIFF function in SQL Server
- GETUTCDATE function in SQL Server
- AVG function in SQL Server
- RIGHT function in SQL Server
- FUNCTION (Function) in SQL Server