LEFT function has the following syntax:
And this is the way to get the table of codes of all alphabetical characters:
Here we use an algorithm of generating of numerical sequence, which is referred to Chapter 8.
It is known that code values of lowercase letters and capital letters differ. That's why in order to get the whole set without rewriting above query; it will be enough to write up the identical code to aforesaid:
Now let's consider the task of searching a substring in a string expression. The two functions can be used for this: CHARINDEX and PATINDEX. They both return a starting position (a position of the first character of a substring) of a substring in a character string.