How to Use the LTRIM() Function in SQL Server: A Comprehensive Guide

Rumman Ansari   Software Engineer   2024-07-21 09:33:02   5661  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Syntax:

<span class="pln">
LTRIM</span><span class="pun">(</span><span class="typ">Character_Expression</span><span class="pun">)</span><span class="pln"> 
</span>

Removes blanks on the left handside of the given character expression.

Example: Removing the 3 white spaces on the left hand side of the ' Hello' string using LTRIM() function.

Code:

<span class="pln">
</span><span class="typ">Select</span><span class="pln"> LTRIM</span><span class="pun">(</span><span class="str">'   Hello'</span><span class="pun">)</span><span class="pln">
</span>

Output:

The above code will produce the following result-

<span class="pln">
</span><span class="typ">Hello</span><span class="pln">
</span>

No Questions Data Available.
No Program Data.

Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.