Overview
The NCHAR function is used to get the actual character when the UNICODE value is provided.
Explanation
Syntax
NCHAR(value)Parameters
- value – this is an integer value from 0 to 65535 that is used to find the Unicode character.
Simple NCHAR Example
The following example will show the Unicode character related to the value provided.
SELECT NCHAR(49)
SELECT NCHAR(50)
SELECT NCHAR(51)
SELECT NCHAR(65)
SELECT NCHAR(66)We get the following values:
1
2
3
A
BGet List of All NCHAR Values and Integer Value
The following will get a list of the code values and the corresponding Unicode character.
DECLARE @counter INT = 0
CREATE TABLE #NCharValues ([nchar] nchar(1), [unicode] int)
WHILE (@counter <= 144697)
BEGIN
BEGIN TRY
INSERT INTO #NCharValues
SELECT NCHAR(@counter), UNICODE(NCHAR(@counter))
SET @counter = @counter + 1
END TRY
BEGIN CATCH;
SET @counter = @counter + 1
IF @counter > 144697
BEGIN
BREAK
END
END CATCH
END
SELECT [UNICODE], [nchar] FROM #NCharValues
DROP TABLE #NCharValuesHere are a few rows from the query results.

Additional Information

Daniel Calbimonte is a Microsoft Most Valuable Professional, Microsoft Certified Trainer and Microsoft Certified IT Professional for SQL Server. He is an accomplished SSIS author, teacher at IT Academies and has over 10 years of experience as a QE and developer for SQL Server related software. He has worked for the government, oil companies, web sites, magazines and universities around the world. Daniel also regularly speaks at SQL Servers conferences and blogs.
- MSSQLTips Awards: Author of the Year Contender – 2015-2018, 2022, 2023 | Champion (100+ tips) – 2018


