title: SQL varchar character limit
body: <p>I have read different explanations of <code>varchar</code> and so far I've gotten this:</p>
  
  <pre><code>CHAR( )      fixed from 0 to 255 characters long 
  VARCHAR( )   variable from 0 to 255 characters long 
  TINYTEXT     maximum length of 255 characters 
  TEXT         maximum length of 65535 characters 
  BLOB         maximum length of 65535 characters 
  MEDIUMTEXT   maximum length of 16777215 characters 
  MEDIUMBLOB   maximum length of 16777215 characters 
  LONGTEXT     maximum length of 4294967295 characters 
  LONGBLOB     maximum length of 4294967295 characters
  </code></pre>
  
  <p>and then this</p>
  
  <ul>
  <li><p><strong>char(n)</strong> variables store fixed-length character strings conisisting of exactly n characters (and, therefore, n bytes). They are limited to 8,000 characters in size.</p></li>
  <li><p><strong>nchar(n)</strong> variables store fixed-length Unicode character strings conisisting of exactly n characters (and, therefore, 2*n bytes). They are limited to 4,000 characters in size.</p></li>
  <li><p><strong>varchar(n)</strong> variables store non-fixed length character strings consisting of approximately n characters. They consume l+2 bytes of space, where l is the actual length of the string. They are limited to 8,000 characters in size.</p></li>
  <li><strong>nvarchar(n)</strong> variables store non-fixed length Unicode character strings consisting of approximately n characters. They consume 2*l+2 bytes of space, where l is the actual length of the string. They are limited to 4,000 characters in size.</li>
  <li><strong>varchar(max)</strong> variables store non-fixed length character strings consisting of up to 1,073,741,824 characters. They consume l+2 bytes of space, where l is the actual length of the string.</li>
  <li><strong>nvarchar(max)</strong> variables store non-fixed length Unicode character strings consisting of up to 536,870,912 characters. They consume l*2+2 bytes of space, where l is the actual length of the string.</li>
  <li><strong>text</strong> and <strong>ntext</strong> variables store up to 2GB of text data (ANSI and Unicode, respectively), but can not be used in many text operations. Therefore, they are usually only used to support legacy applications and have been replaced by the varchar(max) and nvarchar(max) data types.</li>
  </ul>
  
  <p>So really what is the character max on <code>varchar</code>? Reason I am wondering is I am starting a simple little <code>CMS</code> and I don't want my SQL DB to overloaded with weight and as you can see for example</p>
  
  <pre><code>nvarchar(max)[length] * 2 + 2 
  nvarchar being 100,000 * 2 + 2 = 200,002 bytes (what is + 2 is it literal?)
  </code></pre>
  
  <p>Also I've read that <code>varchar(8,000)</code> is better than <code>varchar(max)</code> so what would you suggest the type that I use for a variably changing character length, especially for content.</p>