Nchar Function In Sql in SQL
? NCHAR Function in SQL
The NCHAR() function returns the Unicode character for a given integer code point. It is used to convert an integer ASCII/Unicode code into its corresponding Unicode character.
? Syntax:
NCHAR(integer_expression)integer_expression: The Unicode code point (an integer) you want to convert.
? Example:
SELECT NCHAR(65) AS character;Result:
| character |
|---|
| A |
Because 65 is the Unicode (and ASCII) code for uppercase 'A'.
? Notes:
Useful when you want to convert Unicode code points to characters.
Supported in:
SQL Server
Oracle (also supports
NCHAR)
In MySQL, similar functionality is available with
CHAR()function with charset.
Related functions:
UNICODE()— returns the Unicode code point of a character.CHAR()— returns the character for an ASCII code (non-Unicode in some DBs).
Want an example with multiple characters or usage in a query?