SQL Server: LTRIM Function

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

Description

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

Syntax

The syntax for the LTRIM function in SQL Server (Transact-SQL) is:

LTRIM( string )

Parameters or Arguments

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

Note

Applies To

The LTRIM function 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

Example

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

For example:

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

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

SELECT LTRIM('   Tech on the Net');
Result: 'Tech on the Net'