Data Loader

RTRIM function in MS SQL Server and MySQL

RTRIM stands for right trim, and it trims blank spaces occurring on the right side of a given string.

MSSQL

Syntax

RTRIM(string)

Example

select RTRIM('smith    ');
------------------------
smith
select RTRIM('Hello');
-------------------
Hello

RTRIM_Function_Example1

select 'Smith '+' David' as Normal_String,RTRIM('Smith ')+' David' as [truncated string]
Normal_String		 truncated string
-------------		 ----------------
Smith   David 		 Smith David

RTRIM function example in MSSQL

MySQL

In MySQL the RTRIM function also does the same job. i.e. it trims any blank spaces from the right side of a given string.

Syntax

RTRIM(string)

Example

mysql> select RTRIM('smith  ');
+-------------------+
| RTRIM('smith  ')  |
+-------------------+
| smith             |
+-------------------+
1 row in set (0.00 sec)

mysql> select RTRIM('Hello');
+----------------+
| RTRIM('Hello') |
+----------------+
| Hello |
+----------------+
1 row in set (0.00 sec)
LTRIM function in MySQL
 

Back to Converting Functions from MSSQL to MySQL