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 :

  1. 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 :

  1. See also LTRIM function with the same function but on the right side.
  2. 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

Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile