Returns a character string with the first character having an ASCII value equal to the argument expression. CHAR is identical to CHR but provides ODBC‑compatible syntax.

Syntax

CHAR ( integer_expression )

Notes

  • The argument to the function must be of type INTEGER, TINYINT, or SMALLINT.
  • The result is of type CHARACTER.
  • If the argument integer_expression evaluates to NULL, the result is NULL.
  • The CHAR and CHR functions are character‑set dependent and support single‑byte and multi‑byte characters. If integer_expression is a valid character encoding integer value in the current SQL server character set, the function returns the correct character. If it is not a valid character, the function returns a NULL value.

Example

This example illustrates the CHAR function:

SELECT *
    FROM  customer
    WHERE SUBSTR (zip, 1, 1) = CHAR (53) ;

Compatibility

ODBC compatible