What's the difference between varchar and nvarchar with Microsoft SQL Server

  • VARCHAR: Variable-length, NON-UNICODE character data: VARCHAR[(n)]
    1. The length can be any value between 1 and 8,000.
    2. The storage size is the actual length of data entered + 2 bytes. The data entered can be 0 characters in length.
    3. The SQL-2003 synonyms for varchar are CHAR VARYING or CHARACTER VARYING.
  • NVARCHAR: Variable-length, UNICODE character data: NVARCHAR[(n)]
    1. The length can be any value between 1 and 4,000.
    2. Because it is UNICODE, each character is 2 bytes. The storage size is twice the actual number of characters entered + 2 bytes.
    3. The SQL-2003 synonyms for nvarchar are NATIONAL CHAR VARYING or NATIONAL CHARACTER VARYING.

What's the difference between char and nchar

Basically the same as between varchar and nvarchar.

  • CHAR: Fixed-length, NON-UNICODE character data: CHAR[(n)]
    1. The length can be any value between 1 and 8,000.
    2. The storage size is the declared length + 2 bytes.
    3. The SQL-2003 synonyms for char is CHARACTER.
  • NCHAR: Fixed-length, UNICODE character data: NCHAR[(n)]
    1. The length can be any value between 1 and 4,000.
    2. Because it is UNICODE, each character is 2 bytes. The storage size is twice the declared length + 2 bytes.
    3. The SQL-2003 synonyms for nvarchar are NATIONAL CHAR or NATIONAL CHARACTER.