loading..
Русский    English
02:44

UNICODE and NCHAR functions

UNICODE(ncharacter_expression) returns the Unicode value for the first character of the input expression.

NCHAR(integer) returns a character with the given integer Unicode value.

There are few examples.

Console
Execute
  1. SELECT ASCII('а'), UNICODE('а')
returns the ASCII-code value and the Unicode value of the Russian letter "а": 224 and 1072.

Console
Execute
  1. SELECT CHAR(ASCII('а')), CHAR(UNICODE('а'))

Here we try to recover a symbol by its code value. We get "а" and NULL. The NULL-value returns because the 1072 code value is absent in the usual code table.

Console
Execute
  1. SELECT CHAR(ASCII('а')), NCHAR(UNICODE('а'))

Now it's all right, "a" in both cases. Finally,

Console
Execute
  1. SELECT NCHAR(ASCII('а'))
will give "à", because the Unicode value 224 exactly corresponds to this letter.

Bookmark and Share
The book was updated
yesterday
©SQL-EX,2008 [Evolution] [Feedback] [About] [Links] [Team]
All right reserved.
Rambler's Top100