NCHAR function is used to convert integer value to Unicode character specified by Unicode Standards.
Syntax of NCHAR Function :
NCHAR (integer_expression)
integer_expression can be any positive number from 0 to 65535. If you specify number other than this range then it returns NULL.
Return type of NCHAR function is nchar(1).
Examples of NCHAR Function :
Example 1 : Use of NCHAR function in select clause
SELECT NCHAR(69)
Output
E
Above example returns unicode character value 'E' for integer value 69.
Example 2 : Use of NCHAR function to display unicode value for field value of table.
SELECT NCHAR(UnitPrice) AS 'UnitPrice'
FROM Invoices
Output
UnitPrice
Above example displays unicode character value for unitprice field of invoices table.
Example 3 : Use of NCHAR function in where clause
SELECT CustomerName
FROM Invoices
WHERE NCHAR(ProductID) = '<'
Output
Ernst Handel
Romero y tomillo
Bottom-Dollar Markets
QUICK-Stop
LINO-Delicateses
Above example compares unicode of productid with '<' sign and displays all records having productid unicode as '<'.