Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Char vs Varchar - Performance
Message
De
01/02/2005 11:27:56
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
00982531
Message ID:
00982700
Vues:
44
Tom,

If one audits the data that flows in and out of a database, then even with char and varchar data types, a NULL or a space is a significant difference. A NULL means that data was never entered. A space means that something was entered at one time and then someone changed their mind and got rid of it at a later time. That seems significant to me. ;)

~~Bonnie



>Bonnie;
>
> "a NULL is almost always different than empty".
>
>I was taught that you should use null for all data types to indicate that no data has been written. Giving it further thought it does not make sense to me to use null with char or varchar types when a space will indicate no data exists. Absolute statements as I learned in SQL Server classrooms (“Always use a null”! ) seem to not always be accurate. In the end it may be up to the designer to define such things.
>
>Tom
>
>
>>Sergey,
>>
>>It sounds like you and I don't agree on the use of NULLs. We use NULL for most columns, unless it's a PK or an FK that *must* be populated. IMHO, a NULL is almost always different than empty. Even for character data.
>>
>>~~Bonnie
>>
>>
>>
>>>>>Yes, in SQL 2000 fixed lenght data types always take the same space regardless what value is stored in it.<
>>>>
>>>>Another good reason to use varchars!!! <g>
>>>
>>>I'm not sure why would you want to use Null in the char/varchar field in the first place unless empty values is not the same as Null.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform