SQL Server: NCHAR Function

This SQL Server tutorial explains how to use the NCHAR function in SQL Server (Transact-SQL) with syntax and examples.

Description

In SQL Server (Transact-SQL), the NCHAR function returns the Unicode character based on the number_code in the Unicode standard.

Syntax

The syntax for the NCHAR function in SQL Server (Transact-SQL) is:

NCHAR( number_code )

Parameters or Arguments

number_code
The NUMBER code in the Unicode standard used to retrieve the character.

Note

  • The NCHAR function will accept a number_code that is an integer value ranging from 0 to 65,535.

Applies To

The NCHAR function can be used in the following versions of SQL Server (Transact-SQL):

  • SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005

Example

Let’s look at some SQL Server NCHAR function examples and explore how to use the NCHAR function in SQL Server (Transact-SQL).

For example:

SELECT NCHAR(116);
Result: 't'

SELECT NCHAR(84);
Result: 'T'

View a listing of the ASCII values.