UNICODE() Function in SQL Server

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

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

Syntax :


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.


Output :


Example-2 :
Using UNICODE function with table columns.

Table -Player_Details

PlayerId PlayerName City
45 Rohit Sharma Mumbai
18 Virat Kohli Bangalore
7 MS Dhoni Chennai
42 Sikhar Dhawan Delhi
SELECT UNICODE(PlayerName) AS UnicodeOfFirstChar, PlayerName 
FROM Player_Details;

Output :

UnicodeOfFirstChar PlayerName
82 Rohit Sharma
86 Virat Kohli
77 MS Dhoni
83 Sikhar Dhawan
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.