Monday, November 19, 2012

What's the difference between: char nchar varchar nvarchar


  1. char and varchar are both character data types.
  2. The difference is that char is fixed length and varchar is variable length. 
  3. Use char when the sizes of the column data entries are consistent or similar, for example,  city code or phone number. 
  4. Use varchar when the sizes of the column data entries vary considerably, e.g. shipping addresses, URL, so that a shorter value takes less space than a longer one.
  5. nchar and nvarchar are similar to char and varchar, but they are used to store Unicode data (using the UNICODE UCS-2 character set)