Returns the ASCII code for the first character in an expression.
ascii(char_expr | uchar_expr)
is a character-type column name, variable, or constant expression of char, varchar, nchar or nvarchar type.
is a character-type column name, variable, or constant expression of unichar or univarchar type.
select au_lname, ascii(au_lname) from authors where ascii(au_lname) < 70
au_lname ------------------------------ ----------- Bennet 66 Blotchet-Halls 66 Carson 67 DeFrance 68 Dull 68
Returns the authors last names and the ACSII codes for the first letters in their last names, if the ASCII code is less than 70.
ascii, a string function, returns the ASCII code for the first character in the expression.
When a string function accepts two character expressions but only one expression is unichar, the other expression is “promoted” and internally converted to unichar. This follows existing rules for mixed-mode expressions. However, this conversion may cause truncation, since unichar data sometimes takes twice the space.
If char_expr or uchar_expr is NULL, returns NULL.
For general information about string functions, see “String functions”.
SQL92 – Compliance level: Transact-SQL extension.
Any user can execute ascii.
Functions char, to_unichar