MS SQL Server NCHAR() Function
Sometimes you may need to convert an integer value to an Unicode character in MS SQL Server. There is a function called NCHAR
in MS SQL Server by which you can do this. NCHAR
function returns an Unicode character with a specified integer value, as defined by the Unicode standard.
Let’s see the function syntax:
NCHAR(integer_expression);
In this syntax:
- In this function there is one parameters of integer_expression.
- Parameter integer_expressionis is an integer from 0 through 65535 (0 through 0xFFFF).
- Parameter integer_expressioncan be a constant, variable, or column.
NCHAR
returns aNULL
value for integer expressions outside this range.- Function returns a Unicode character of the value of integer_expression.
The following example uses NCHAR
function to convert an integer value to an Unicode character.
SELECT NCHAR(2534) AS bd_0, NCHAR(2543) AS bd_9;
Here is the result set.
bd_0 | bd_9 |
---|---|
০ | ৯ |
I have an another post MS SQL Server String Related Functions where you will learn about different string related functions of MS SQL Server.
In this tutorial, I have shown you how to convert an integer value to an Unicode character in MS SQL Server. Hope you have enjoyed the tutorial. If you want to get updated, like my facebook page http://www.facebook.com/freetechtrainer and stay connected.