Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Char(100) field VS Text
Message
 
To
19/04/2012 09:56:41
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01542085
Message ID:
01542145
Views:
36
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform