The NCHAR() function in SQL Server is used to return the Unicode character equivalent of an integer value. It takes an integer (representing a Unicode code point) as an argument and returns the character associated with that Unicode value.
Syntax:
NCHAR(integer_expression)
integer_expression: This is an integer that specifies a Unicode code point. It must be in the range of 0 to 65535 (i.e., it should be a valid Unicode character).
Example:
SELECT NCHAR(65) AS Character;
This will return the character A, since the Unicode value of 65 corresponds to the letter A.
Example with a String:
SELECT NCHAR(100) + NCHAR(101) AS Letters;
This will return de because:
100corresponds tod101corresponds toe
Notes:
NCHAR()returns a single Unicode character.- The result is always a
nvarchardata type. - The
NCHAR()function is typically used when working with Unicode data (especially when dealing with international characters or special symbols).
No comments:
Post a Comment