Instruction
Well done! Now that we know about concatenation, let's learn some string functions. We'll start with a simple one.
The LEN() function shows the length of a string column. For example:
SELECT FirstName, LEN(FirstName) AS Length FROM Copywriter;
Suppose that 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').
Exercise
Show the ID number, text, and string length for every slogan in the Slogan table. Name the last column Length.
Stuck? Here's a hint!
Use LEN(Text).



