The NVARCHAR data type stores Unicode character data, up to 8191 characters.
NVARCHAR [ ( 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 in UTF-8 encoding. The maximum storage number of bytes required is four multiplied by max-length, although the actual storage required is usually much less.
NVARCHAR can also be specified as NCHAR VARYING, NATIONAL CHAR VARYING, or NATIONAL CHARACTER VARYING. Regardless of which syntax is used, the data type is described as NVARCHAR.
When an embedded SQL client performs a DESCRIBE on a NVARCHAR column, the data type returned is either DT_VARCHAR or DT_NVARCHAR, 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 NVARCHAR 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 NVARCHAR(10) column is described as type DT_NVARCHAR of length 10 (10 characters multiplied by a maximum of one byte per character). For an embedded SQL client using the Japanese character set cp932, the same column is described as type DT_NVARCHAR of length 20 (10 characters multiplied by a maximum two bytes per character).
For ODBC, NVARCHAR is described as 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 |