Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the N in varchar(N) refer to

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.

like image 286
Mercurious Avatar asked Apr 16 '09 10:04

Mercurious


People also ask

What does N mean in SQL?

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.

What does N stand for in nvarchar?

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).

What is the default size of N in a column which is defined as 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.

What is the difference between CHAR N and Nchar N )?

char : fixed-length character data with a maximum length of 8000 characters. nchar : fixed-length unicode data with a maximum length of 4000 characters.


1 Answers

It's the maximum number of characters.

nvarchar(1000) = max 1000 unicode chars.

like image 188
mmx Avatar answered Oct 18 '22 05:10

mmx