I am going to write a series of very short articles or tidbits on Transaction SQL (TSQL) functions. I will exploring the UNICODE() function today. Transaction SQL (TSQL) supports the UNICODE() function that takes a NCHAR or NVARCHAR datatype as input and returns a INT datatype as output. The output value corresponds to the unicode characters location in a chart. This value can range from 0 to 65535. The following example returns the unicode value for a space which is a value of 32.
1 2 3 4 5 |
-- A simple space declare @var_tmp1 nchar = ' '; -- Return ascii # select unicode(@var_tmp1) as unicode_val; |
1 2 3 4 5 |
output: unicode_val ----------- 32 |
One thing to always…