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.
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
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 |
Last Updated :
28 Sep, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...