Explain LEN() Function in SQL?

LEN() function calculates the number of characters of an input string, excluding the trailing spaces.

Syntax :

LEN(input_string)

Parameter –

This method accepts a single-parameter as mentioned above and described below :

input_string –

It is an expression that can be a constant, variable, or column of either character or binary data.

Returns :

It returns the number of characters of an input string, excluding the trailing spaces.

Example-1: Return the length of a string

SELECT LEN('HelloWorld');

Output :

10