Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00028660
Message ID:
00028702
Vues:
43
>I was doing a simple SQL with SUMs and got a numeric overflow error at random intervals. The code was:
>
>SELECT sum(lineitem) as linetotal, sum(iif(taxable, lineitem, 0)) as taxtotal from MyTable into cursor MyCursor
>
>The problem was the sum(iif(taxable, lineitem,0)) which worked about 95% of the time and gave me the numeric overflow error the remaining times. I presume I have to set the size of the numeric field, as must be done with variable length character fields, but don't know how.
>
>All help gratefully accepted.
>
>TIA
>Barbara

It should work:
SELECT sum(lineitem)+000000000 as linetotal, ;
sum(iif(taxable, lineitem, 0))+000000000 as taxtotal from MyTable into cursor MyCursor

Add reasonable number of zeros.
The reason was that Foxpro allocates cursor field width (if AS clause used) based on first selected record.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform