What does the N in varchar(N) refer to when describing a field in a database. Is it the number of characters or bytes. Also, one is using UTF-8, a character may use more than one byte.
The "N" prefix stands for National Language in the SQL-92 standard, and is used for representing Unicode characters. In the current standard, it must be an upper case , which is what you will typically find implemented in mainstream products.
However, in nchar(n) and nvarchar(n), the n defines the string length in byte-pairs (0-4,000). n never defines numbers of characters that can be stored. This is similar to the definition of char(n) and varchar(n).
VARCHAR(n) In this syntax, n defines the string length that ranges from 1 to 8,000. If you don't specify n, its default value is 1.
char : fixed-length character data with a maximum length of 8000 characters. nchar : fixed-length unicode data with a maximum length of 4000 characters.
It's the maximum number of characters.
nvarchar(1000)
= max 1000 unicode chars.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With