SQL Server string function is a built-in string function. Some operations performed on strings require that you know the number of characters of a string. This is because some operations require a minimum number of characters and some other functions require that the string have at least one character. The number of characters of a string is also called the length of the string. It perform an operation on a string input value and return a string or numeric value.
To get the length of a string, you can use the LEN () function.
The syntax of the LEN () function is:
Int LEN (String)
DECLARE @ASCII varchar(120)
SET @ASCII = ' American Standard Code for Information Interchange'
SELECT @ASCII AS ASCII
SELECT LEN(@ASCII) AS [Number of Characters]
The result is displayed below with LEN () function.