Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any side effects in allowing NULL?
Message
De
31/03/2012 12:05:40
 
 
À
31/03/2012 10:40:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01539772
Message ID:
01539911
Vues:
62
>>>What do you put in the Age field when you don't know the age?
>Good question, Viv.
>The answer is that we need a rule.
>Assuming that it's a numeric column, I might use -1 to indicate that the age isn't known. Someone else might use some other rule.
>Why wouldn't I use NULL?
>If I'm the poor bloke who looks at this table without knowing the rules, if I see -1 I'm alerted to the fact that someone did that on purpose and it must mean something so I'd better find out what it is.

>If I see a NULL, I'm never sure that some sloppy programmer just didn't populate the column properly, as has happened to me on numerous occasions.

Sounds good. But I've always favoured using 999 in this scenario. Of course the 'poor bloke who looks at this table' would know that if he sees a -1 he should ask you what it means and if he sees '999' then he should ask me.

What if the field is a year where -20,000,000 -> +20,000,000 are valid values (unless you are a creationist). What shall we you use then for 'unknown' . -1 and 999 will be a bit ambiguous....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform