SQL Server NCHAR() Function: Unicode of Integer

In SQL Server, NCHAR() function returns the Unicode character with the specified integer code, as defined by the Unicode standard.



integer_expression: A positive integer from 0 through 65535, when the database does not support the supplementary characters flag. When supplementary character flag is supported, then the input integer range is 0 through 1114111.

Return Value

Returns nvarchar(2) when the database collation supports supplementary character; otherwise, returns nchar(1). Returns NULL if specified integer values is not in range.

Example 1:

In the following example, pass 123 to the NCHAR()function.

Example: NCHAR()
SELECT NCHAR (123) AS Result;

Example 2:

The NCHAR() function will return NULL if you pass a positive integer greater than 65535, as shown below.

Example: NCHAR()
SELECT NCHAR(665578) AS Result;
Want to check how much you know SQL Server?