Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NChar vs. Char (NVarChar vs. VarChar)
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01070514
Message ID:
01070606
Vues:
12
>>Another "versus" question.
>>
>>What are some of the advantages of choosing NChar (or NVarChar) over Char (or VarChar)? Char and VarChar consumes 1 byte per character and NChar and NVarChar consumes 2 bytes per character, correct?
>
>Einar,
>
>The data types with N prefix (nchar, nvarchar and ntext) are used to store the Unicode data but each chracter uses 2 bytes to store.

I know that data types with the N prefix stores unicode characters. Thanks for confirming that data types with N prefix consumes 2 bytes for every character. Do you know of any advantage of using data types with the N prefix over the data types without the N prefix? The only advantage I can see is if the app is mutilingual.
The reason I am having a hard time grasping this is because a string (in .NET) is always unicode and both VarChar and NVarChar is converted into a string in .NET. I have not been able to a string from .NET into a VarChar field, that causes gibberish to appear in the table. When would VarChar be an insufficient data type?

Einar
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform