LTRIM function in SQL Server

LTRIM function in SQL Server is used to delete all space characters from the first position (left positions) of the string.

The article will learn and show you how to use the LTRIM function in SQL Server to delete all space characters from the left-hand positions of the string.

Describe

LTRIM function in SQL Server is used to delete all space characters from the first position (left positions) of the string.

Syntax

To use the LTRIM function in SQL Server, we use the following syntax:

 LTRIM(chuoi) 

Parameters :

  1. string : the string you want to cut space characters from the left side. This string must be a character expression or binary data. It can be a string, variable or column.

Note :

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

 SELECT LTRIM(' TipsMake.com'); 
Result: 'TipsMake.com'

SELECT LTRIM(' TipsMake.com ');
Result: 'TipsMake.com '

SELECT LTRIM(' Quan Tri Mang');
Result: 'Quan Tri Mang'

Previous article: LOWER function in SQL Server

Next lesson: REPLACE function in SQL Server

4.5 ★ | 4 Vote