Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Char(100) field VS Text
Message
 
 
À
19/04/2012 11:06:27
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:
01542123
Vues:
22
>>This error message means you can not use Text type for = operator. You need to use varchar(max) or nvarchar(max) to avoid all TEXT type related problems.
>
>So, using VarChar(10) wouldn't work. And, when using VarChar(MAX), this increases the size of the database. We have seen an example on this site. In order to support multilanguage, I had to switch to that type. This has tripled the size of the database. So, no matter the ratio of increase, it will increase by a certain percentage when using that type because it allows a greater support. But, in my case, I do not use that additional support. So, this means, we cannot search for an exact match using VarChar(10) and I do not want to switch to VarChar(MAX) to have that support because of the down benefit I would obtain. So, the question is should I remain with Char(10) instead, which would then allocate more space, even if the record contains an empty value for that field. That is a good question isn't it?

I don't understand how you're making this conclusion from what I said. If the maximum size of data is 10 chars, then varchar(10) will work fine.
vachar(10) takes less space than char(10) but you may not see it immediately, perhaps after index re-build.

nvarchar(10) can take more space than char(10). For small character fields (less than 10) char or varchar doesn't matter much.

Also, if your data were originally char, just switching to varchar will not help. You may need to remove all trailing spaces in all data first.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform