LEN() Function in SQL Server
The LEN function in the SQL Server fetches the number of characters in a string. It counts the preceding spaces but not the trailing spaces.
For eg,
- ‘SQL SERVER’ has 10 characters
- ‘SQL SERVER ‘ also has 10 characters as the LEN function ignores the spaces at the end of the string.
It returns NULL for NULL string values. It is used in validating string lengths, padding strings to a certain length, or processing strings based on their length
SQL Server LEN() Function
SQL SERVER LEN() function calculates the number of characters of an input string, excluding the trailing spaces.