Well done! Now that we know about concatenation, let's learn some string functions. We'll start with a simple one.
LEN() function shows the length of a string column. For example:
LEN(FirstName) AS Length
FirstName has a value of "Anne".
LEN() will return a 4 because "Anne" has 4 letters. Simple, isn't it?
It's good to know that
LEN() in SQL Server removes spaces from the end of a string. Look at another example:
SELECT LEN(N' Martin Bag ');
LEN() returns 11. After the trailing blanks are removed, this text consists of 11 characters (the name with a leading space:
N' Martin Bag').