InterSystems SQL Reference
ASCII
|
|
A string function that returns the integer ASCII code value of the first (leftmost) character of a string expression.
Synopsis
ASCII(string-expression)
{fn ASCII(string-expression)}
ASCII returns NULL if passed a NULL or an empty string value. The returning of NULL for empty string is consistent with SQL Server.
Note that
ASCII can be invoked as an ODBC scalar function (with the curly brace syntax) or as an SQL general function.
The following examples both returns 90, which is the ASCII value of the character Z:
SELECT ASCII('Z') AS AsciiCode
SELECT {fn ASCII('ZEBRA')} AS AsciiCode
InterSystems SQL converts numerics to
canonical form before performing
ASCII conversion. The following example returns 55, which is the ASCII value of the number 7:
SELECT ASCII(+007) AS AsciiCode
This number parsing is not done if the numeric is presented as a string. The following example returns 43, which is the ASCII value of the plus (+) character:
SELECT ASCII('+007') AS AsciiCode
Content Date/Time: 2019-02-18 01:15:52