|
nvarchar
The term nvarchar(n) describes a
datatype.
Like all
character datatypes,
the datatype nvarchar(n) is also compatible to the
ANSI-Standard.
The values which can be stored in
columns
defined with nvarchar(n), are always of the fixed length n (fixed-length character string).
Therefor, the datatype nvarchar(n) always requires n
bytes
of
storage,
independent from the length of the character string.
Strings longer than n are cut off after the nth character. The range for the variable n is between 1 and 255 (ASE-version 12.0) and between 1 and 16384
(starting with ASE-version 12.5). The exact value for the required storage in bytes can be determined using the formula "1..n * @@ncharsize".
Usage of the Datatype nvarchar(n)
The datatype nvarchar(n) can be used for storing
character sets
with a predictable fixed length (fixed-length character string) or which are no longer than 5 characters. Examples can be post codes, insurance or customer numbers. nvarchar(n) should be used if the
"character set"
to be used requires more than one byte of storage per character, i.e. for so-called
multibyte character sets,
like for example Japanese or
Chinese. For
singlebyte character sets,
like for example for Englisch
the datatype
char(n)
is sufficient.
See also:
nchar, text, unichar(n), univarchar(n), varchar(n).
|