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
You've just finished reading the article "RTRIM function in SQL Server" edited by the TipsMake team. You can save rtrim-function-in-sql-server.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.
- MAX function in SQL Server
- FUNCTION (Function) in SQL Server
- SUM function in SQL Server
- AVG function in SQL Server
- ABS function in SQL Server
- DATEPART function in SQL Server
- DATENAME function in SQL Server
- ROUND function in SQL Server
- CEILING function in SQL Server
- RIGHT function in SQL Server
- FLOOR function in SQL Server
- MONTH function in SQL Server
- DATEDIFF function in SQL Server
- GETUTCDATE function in SQL Server