Returns the ASCII code value of the leftmost character of a character expression.
Transact-SQL Syntax Conventions
character_expression
An expression of type char or varchar.
int
ASCII stands for American Standard Code for Information Interchange. It serves as a character encoding standard for modern computers. See the Printable characters section of ASCII for a list of ASCII characters.
This example assumes an ASCII character set, and returns the ASCII
value for 6 characters.
SELECT ASCII('A') AS A, ASCII('B') AS B,
ASCII('a') AS a, ASCII('b') AS b,
ASCII(1) AS [1], ASCII(2) AS [2];
Here is the result set.
A B a b 1 2
----------- ----------- ----------- ----------- ----------- -----------
65 66 97 98 49 50
CHAR (Transact-SQL)
NCHAR (Transact-SQL)
UNICODE (Transact-SQL)
String Functions (Transact-SQL)