Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Char(100) field VS Text
Message
 
À
19/04/2012 09:56:41
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01542085
Message ID:
01542145
Vues:
37
>>nVarchar(100) does not reserve space for 100 chars if the contents are less than 100 chars
>
>So, basically, is it correct to assume that some might always use nVarchar everywhere and never use Char() in favor of space allocation?

No, char still has its place, wherever you need to store fixed size strings (let's say the SIN, 9 chars) or mostly the same size (let's say car license plates, 6 or 7 characters) (I know my examples are very short), if you use varchar for this examples, you are actually paying an overhead of 2 bytes per record, that is the space reserved by SQL to store the length of the actual string.
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform