Returns the number of characters in a string. Trailing spaces are counted in a VARCHAR or LONGVARCHAR string. Trailing NULLs are counted in a CHAR and LONGVARCHAR string. The string termination character is not counted.
The following example results in first name trimmed to three characters beginning from left, the length as 9 and locate results 0. This query results in "Roo", 9, 0
SELECT LEFT(First_name, 3),LENGTH(First_name), LOCATE(First_name, 'a') FROM Person WHERE First_name = 'Roosevelt'
Thursday, 18 April 2019 Posted in String Functions