Thursday, December 28, 2006

char, varchar, nchar, nvarchar

nchar and nvarchar are used for unicode data, which require twice as much space (bytes) to store the same non-unicode characters. It is a significant disadvantage to use nchar and nvarchar if we do not need unicode charactors. Only use nchar & nvarchar when you need unicode charactors
use char & nchar when the length of the data is fixed, e.g. all customerID must be CUST_XXXX. use varchar and nvarchar when the length of the data is uncertain, e.g. customerID starts from 1 to 100000.

No comments: