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:
UNION
SELECT CHAR(ASCII('A')+ num-1) letter, ASCII('A')+ num - 1[code]
FROM(SELECT5*5*(a-1)+5*(b-1) + c AS num
FROM(SELECT1 a UNIONALLSELECT2UNIONALLSELECT3
UNIONALLSELECT4UNIONALLSELECT5
) x CROSSJOIN
(SELECT1 b UNIONALLSELECT2UNIONALLSELECT3
UNIONALLSELECT4UNIONALLSELECT5
) y CROSSJOIN
(SELECT1 c UNIONALLSELECT2UNIONALLSELECT3
UNIONALLSELECT4UNIONALLSELECT5
) z
) x
WHERE ASCII('A')+ num -1BETWEEN ASCII('A')AND ASCII('Z')
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.