Tutorial :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.


It's the maximum number of characters.

nvarchar(1000) = max 1000 unicode chars.


varchar cannot hold Unicode characters, so n in varchar(n) means both number of characters and number of bytes. In case of nvarchar(n) the n means the number of Unicode characters, with storage size of two times n bytes.

If you query information_schema.columns, there will be, among others, two columns of particular interest: CHARACTER_MAXIMUM_LENGTH and CHARACTER_OCTET_LENGTH. The former holds the number of characters, and the latter contains the number of bytes.


  1. nr of characters

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »