Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP9 and null values and NVL()
Message
De
24/07/2006 14:11:31
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01139317
Message ID:
01139329
Vues:
28
That was my expectation as well. I am surprised (pleasantly) that it doesn't produce an error and it appears to give accurate results, but I can't find any documentation on it. I'm sure it is there somewhere in help. I found out in testing that with sql, if you don't convert it using isnull(), it can give erroneous results. For instance when the value of a bit field allows nulls:

(ISNULL(myfield,0)!=1)

instead of:

myfield!=1

but in VFP9 it doesn't appear to be necessary to convert the null value before checking it.


>Looks like it works without it too for TRUE case, though I would assume to give an error instead.
>
>ll=.t.
>ll=null
>=messagebox(iif(ll,"True","False"))
>
>ll=.f.
>ll=null
>=messagebox(iif(not ll,"False","True"))
>
>
>In other words, I would stay with NVL to give exact result.
>
>
>>Is there anytime that a field which allows nulls would generate an error on the code:
>>
>>
>>IF myfield.myvalue  && is the value .t.?
>>
>>
>>The field value can be .T., .F., or null
>>
>>It is never generating an error, but I have always had the code:
>>
>>
>>IF (NVL(myfield.myvalue,.F.))
>>
>>
>>and am wondering if the NVL() is guaranteed to not be necesssary? I have tested the speed difference
>>and even with over a million records the NVL() speed difference appears negligible. At onetime the
>>NVL() was added to all fields (all types char, date, log, etc) as a safety check more or less.
>>
>>TIA,
>>Tracy
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform