Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VarChar
Message
De
04/04/2006 17:18:12
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Titre:
Divers
Thread ID:
01110397
Message ID:
01110430
Vues:
15
>Borislav,
>
>I personaly, prefer to use varchar(xx) for all string expressions that have a big differences in the length. That keeps DB smaller.
>
>I see. What about corrupted tables? So, I see VarChar fields like MemoFields in VFP. If they don't have fixed size, they can corrupt easier.
>
>Like I said, I'm completly newbie in SQL Server and I'm a little bit scared about it! ;-)

Rudolfo,

You should use varchar for all alpha-numeric columns where the data is not absolutely a certain width. E.g., DATESTR('20060404') is a good candidate for a char(8) column, but NAME is not a good candidate.

There is a large performance and storage benefit to using varchar over char columns when dealing with variable-length data like name and address. There are also many issues when matching char columns to varchar data and string literals (similar to the issues in VFP with string matching).

There is no more danger of corrupting data when using varchar over char columns. Data file corruption does occur, but happens so infrequently in SQL Server that it should not affect database design decisions. A proper maintenance plan that includes backups will handle any corruption problems.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform