December 3, 2007 at 2:50 pm
I was wondering if someone could explain the differences between the nvarchar v. varchar, ntext v. text, and nchar v. char. I understand it from the perspective of the inclusion of the unicode values. My question is how do I decide which type to use as I am designing a database. In other words, what type of questions should I be asking.
Thanks!
December 3, 2007 at 3:00 pm
Basically will you need to handle any extended character lanuages such as chinese or have special characters that don't esit in the default set?
December 4, 2007 at 5:41 am
Do you foresee a need to use character sets from other languages, Kanji, Cyrilic, what have you? No, use VARCHAR. Yes, use NVARCHAR.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
December 4, 2007 at 8:48 am
Thanks for your short but helpful replies.
December 5, 2007 at 7:42 am
Don't forget about Unicode and non-Unicode. If you plan on interfacing with a mainframe (AS400 for example) you might want to consider NVARCHAR; especially if you plan on using SSIS to move data between the boxes.
SSIS does not automatically convert between the 2 code sets so you will need to and it can be a pain to constantly have to convert back and forth.
-Mike
December 6, 2007 at 2:18 am
Replies so far seem to have missed the obvious point that the same text takes up twice as much space in the database as nvarchar - because the unicode character set uses 2 bytes per character. So unless you need funny characters it is better to use varchar. This is not just because of database space - obviously all data being pulled back to the client is doubled up too - so 100 chars of varchar = about 100 bytes but it would be 200 bytes for nvarchar doubling network loads.
James Horsley
Workflow Consulting Limited
December 6, 2007 at 8:11 am
Thanks, James. It looks like I don't need the nvarchar data type for my simple database. I appreciate everyone's response.
December 7, 2007 at 5:36 am
Books On Line?
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply