difference between char, nchar, varchar, and nvarchar

Just to clear up... or sum up...

  • nchar and nvarchar can store Unicode characters.
  • char and varchar cannot store Unicode characters.
  • char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don't use up all that space.
  • varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar.

nchar and nvarchar will take up twice as much storage space, so it may be wise to use them only if you need Unicode support.

 

from http://stackoverflow.com/questions/176514/what-is-the-difference-between-char-nchar-varchar-and-nvarchar-in-sql-server

 

文中说:varchar cannot store Unicode characters

但是,如果char,Varchar字段的Collation属性设置为Chinese_RPC,也能存汉字。

 

 

posted on 2013-02-28 21:54  齐文宣  阅读(151)  评论(0)    收藏  举报

导航