String functions perform different operations on binary data, strings, and expressions. This type of function acts on Char, VARCHAR, BINARY, and varbinary data types and data types that can be implicitly converted to char or VARCHAR. You can use String functions in the Select and WHERE clauses of a SELECT statement and in expressions. The common string functions are:
1. Character conversion function
There are several character conversion functions:
· ASCII ()
The ASCII () function returns the ASCII-code value of the leftmost character of a character expression. The ASCII () function syntax is as follows:
Example 4-40:
Reminder: In the ASCII () function, a string of pure digits can be used without ' enclosing ', but a string with other characters must be enclosed for use, otherwise there will be an error.
· CHAR ()
The CHAR () function is used to convert ASCII code to characters. The syntax is as follows:
If you do not enter an ASCII code value between 0 ~ 255, the CHAR () function returns a null value.
Example 4-41:
· LOWER ()
The LOWER () function converts the string to lowercase, with the following syntax: