Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement