Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
The NCHAR data type stores Unicode character data, up to 8191 characters.
NCHAR [ ( max-length ) ]
max-length The maximum length of the string, in characters. The length must be in the range 1 to 8191. If the length is not specified, then it is 1.
Characters are stored using UTF-8 encoding. The maximum number of bytes of storage required is four multiplied by max-length, although the actual storage required is usually much less.
NCHAR can also be specified as NATIONAL CHAR or NATIONAL CHARACTER. Regardless of which syntax is used, the data type is described as NCHAR.
When an embedded SQL client performs a DESCRIBE on an NCHAR column, the data type returned is either DT_FIXCHAR or DT_NFIXCHAR, depending on whether the db_change_nchar_charset function has been called. See db_change_nchar_charset function.
Also, when an embedded SQL client performs a DESCRIBE on an NCHAR column, the length returned is the maximum byte length in the client's NCHAR character set. For example, for an embedded SQL client using the Western European character set cp1252 as the NCHAR character set, an NCHAR(10) column is described as type DT_NFIXCHAR of length 10 (10 characters multiplied by a maximum one byte per character). For an embedded SQL client using the Japanese character set cp932, the same column is described as type DT_NFIXCHAR of length 20 (10 characters multiplied by a maximum two bytes per character).
NCHAR is semantically equivalent to NVARCHAR, although they are different types. In SQL Anywhere, NCHAR is a variable-length type. In other relational database management systems, NCHAR is a fixed-length type, and data is padded with blanks to max-length characters of storage. SQL Anywhere does not blank-pad stored character data.
For ODBC, NCHAR is described as either SQL_WCHAR or SQL_WVARCHAR depending on the odbc_distingish_char_and_varchar option. See odbc_distinguish_char_and_varchar option [database].
SQL/2003 Vendor extension.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|