Optional new syntax added in Adaptive Server 12.5.1 allows you to specify arbitrary Unicode characters. If a character literal is immediately preceded by U& or u& (with no intervening whitespace), the parser recognizes escape sequences within the literal. An escape sequence of the form \xxxx (where xxxx represents 4 hexadecimal digits) is replaced with the Unicode character whose scalar value is xxxx. Similarly, an escape sequence of the form \+yyyyyy is replaced with the Unicode character whose scalar value is yyyyyy. The escape sequence \\ is replaced by a single \. For example:
select * from mytable where unichar_column = U&'\4e94'
is equivalent to:
The U& or u& prefix simply enables the recognition of escapes. The datatype of the literal is chosen solely on the basis of representability. Thus, for example, the following two queries are entirely equivalent:
select * from mytable where char_column = 'A'
select * from mytable where char_column = U&'\0041'
In both cases, the datatype of the character literal is char, since ‘A’ is an ASCII character, and ASCII is a subset of all Sybase-supported server character sets.
The U& and u& prefixes also work with the double quoted character literals and for quoted identifiers. However, quoted identifiers must be representable in the server’s character set, insofar as all database objects are identified by names in system tables, and all such names are of datatype char.