SQL Server: RTRIM Function

 RTRIM function

This SQL Server tutorial explains how to use the RTRIM function in SQL Server (Transact-SQL) with syntax and examples.


In SQL Server (Transact-SQL), the RTRIM function removes all space characters from the right-hand side of a string.


The syntax for the RTRIM functions in SQL Server (Transact-SQL) is:

RTRIM( string )

Parameters or Arguments


The string to trim the space characters from the right-hand side.


Applies To

The RTRIM functions can be used in the following versions of SQL Server (Transact-SQL):

  • SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005


Let’s look at some SQL Server RTRIM functions examples and explore how to use the RTRIM functions in SQL Server (Transact-SQL).

For example:

SELECT RTRIM('adglob.in   ');
Result: 'adglob.in'

SELECT RTRIM('   adglob.in   ');
Result: '   adglob.in'

SELECT RTRIM('adg lob   ');
Result: 'adg lob'

This Post Has 3 Comments

  1. local news

    You really make it seem so easy with your presentation but I find this topic to be really something that I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I?ll try to get the hang of it!

Leave a Reply

WC Captcha 70 − = 65