ASCII (TSQL Function)

Returns the unicode code point of the first unicode character in the string.

Syntax

ASCII ( string_expression )

Arguments

string_expression
is a string expression of type varchar.

Return Types

Returns int.

Remarks

With RSQL, this function can be used with any unicode character.
With MS SQL Server, only characters in the “ascii” range [0, 255] are allowed. Else, the result is invalid.

Returns NULL for empty string.

See also UNICODE.

Examples

PRINT ASCII('A'), ASCII('ALEX'), ASCII('é'), ASCII('élève'), ASCII('Ф'), ASCII('Феодосия'), ASCII('');

The result is:

         65|         65|        233|        233|       1060|       1060|     <NULL>|