Returns the ASCII code for the first character in an expression.
ascii(char_expr | uchar_expr)
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
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.
See also Transact-SQL Users Guide.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute ascii.