Information générale
Forum:
Microsoft SQL Server
Versions des environnements
SQL Server:
SQL Server 2005
>>I understand NULLS have a special purpose... but I think I'm starting to abuse it. For example, if we have a text comments area that saves to a varchar field, would it be proper to use NULL if the user left the text area blank, or would it be proper to use a blank string?
>
>The NULLs require special handling in queries and in front end. My rule is not to use NULLs unless it's necessary:
>- In datetime columns
>- Foreign keys
>- Any other case where NULL is significant (represents absence of data or N/A).
>
>In your case an empty string seems more appropriate to me.
I agree completely. And in addition to the special handling required, they can be a rich source of bugs if used improperly. I worked on one large application that had been designed by a guy who defined almost everything as nullable. Our most senior client support guy estimated that 60% of bugs reported by customers were related to nulls.
Précédent
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