Skip to content
Related Articles

Related Articles

UNICODE() Function in SQL Server

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Sep, 2020
View Discussion
Improve Article
Save Article

In this article, we are going to cover UNICODE() function where you will see the Unicode for given specific character or for expression character.

UNICODE() :
It is the function that gets the integer value for the first character of the input expression, as defined by the Unicode standard.

Syntax :

UNICODE(ncharacter_expression)

Parameter :
UNICODE function accepts a single parameter that means if you will give simply a character or you can give expression as input then it will read the first character and will return UNICODE for the same.

ncharacter_expression :
It is a nchar or nvarchar expression.

Returns –
UNICODE function will give you an integer value for the first character. It returns an integer value or the Unicode value, for the first character of the input expression.

Example-1 :
It will return the integer value of the first character of the input expression.

SELECT UNICODE('MS Dhoni');

Output :

77

Example-2 :
Using UNICODE function with table columns.

Table -Player_Details

PlayerIdPlayerNameCity
45Rohit SharmaMumbai
18Virat KohliBangalore
7MS DhoniChennai
42Sikhar DhawanDelhi
SELECT UNICODE(PlayerName) AS UnicodeOfFirstChar, PlayerName 
FROM Player_Details;

Output :

UnicodeOfFirstCharPlayerName
82Rohit Sharma
86Virat Kohli
77MS Dhoni
83Sikhar Dhawan
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!