Understanding the LEN() Function in SQL Server: A Comprehensive Guide

Rumman Ansari   Software Engineer   2024-07-21 09:35:09   5768  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Syntax:

<span class="pln">
LEN</span><span class="pun">(</span><span class="typ">String_Expression</span><span class="pun">)</span><span class="pln">
</span>

Returns the count of total characters, in the given string expression, excluding the blanks at the end of the expression.

Code:

<span class="pln">
</span><span class="typ">Select</span><span class="pln"> LEN</span><span class="pun">(</span><span class="str">'SQL Functions   '</span><span class="pun">)</span><span class="pln">
</span>

Output:

The above code will produce the following result-

<span class="pln">
</span><span class="lit">13</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.