Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Statement in SELECT
Message
 
 
À
16/12/2007 09:26:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01276157
Message ID:
01276161
Vues:
21
>Hi:
>
>I have the following code with an iif statement to avoid division by zero. BUT I'm getting zero in all the records even though there should only be a zero in the first.
>
>What is the correct syntax?
>
>Thanks,
>
Yossi,

Assuming you're using VFP9, you may use CAST function to create it correctly:
SELECT CAST (IIF(feedweight = 0,0,feedcost / feedweight) as N(10,4)) feedcostperlb ;
FROM prextab ;
INTO CURSOR test
Also please note, that I switched the check, e.g. you need to check for FeedWeight = 0 instead.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform