Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Certainly <strong>NOT</strong>:</p> <ul> <li><p><code>TEXT, NTEXT</code>: those types are <strong>deprecated</strong> as of SQL Server 2005 and should not be used for new development. Use <code>VARCHAR(MAX)</code> or <code>NVARCHAR(MAX)</code> instead</p></li> <li><p><code>IMAGE</code>, <code>VARBINARY(MAX)</code> : <code>IMAGE</code> is deprecated just like <code>TEXT/NTEXT</code>, and there's really no point in storing a text string into a binary column....</p></li> </ul> <p>So that basically leaves <code>VARCHAR(x)</code> or <code>NVARCHAR(x)</code>: <code>VARCHAR</code> stores non-Unicode strings (1 byte per character) and <code>NVARCHAR</code> stores everything in a 2-byte-per-character Unicode mode. So do you need Unicode? Do you have Arabic, Hebrew, Chinese or other non-Western-European characters in your strings, potentially? Then go with <code>NVARCHAR</code></p> <p>The <code>(N)VARCHAR</code> columns come in two flavors: either you define a maximum length that results in 8000 bytes or less (<code>VARCHAR</code> up to 8000 characters, <code>NVARCHAR</code> up to 4000), or if that's not enough, use the <code>(N)VARCHAR(MAX)</code> versions, which store up to 2 GByte of data.</p> <p><strong>Update:</strong> SQL Server <strong>2016</strong> will have native JSON support - a new <code>JSON</code> datatype (which is based on <code>nvarchar</code>) will be introduced, as well as a <code>FOR JSON</code> command to convert output from a query into JSON format</p> <p><strong>Update #2:</strong> in the final product, Microsoft did not include a separate <code>JSON</code> datatype - instead, there are a number of JSON-functions (to package up database rows into JSON, or to parse JSON into relational data) which operate on columns of type <code>NVARCHAR(n)</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload