Returns an int value representing the ASCII code of the leftmost character of a string.
SELECT ASCII('t') -- Returns 116
SELECT ASCII('T') -- Returns 84
SELECT ASCII('This') -- Returns 84
If the string is Unicode and the leftmost character is not ASCII but representable in the current collation, a value greater than 127 can be returned:
SELECT ASCII(N'ï') -- returns 239 when `SERVERPROPERTY('COLLATION') = 'SQL_Latin1_General_CP1_CI_AS'`
If the string is Unicode and the leftmost character cannot be represented in the current collation, the int value of 63 is returned: (which represents question mark in ASCII):
SELECT ASCII(N'߷') -- returns 63
SELECT ASCII(nchar(2039)) -- returns 63