Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01334144
Message ID:
01334145
Vues:
9
This message has been marked as the solution to the initial question of the thread.
Jon,

VFP incorrectly determines the size of the calculated field (1 digit) in the result. In VFP9 you can use CAST() function, in previous versions put as many zeros as the size of the field you want to be.
Assuming that 3 digits is enough
* VFP 9

CAST((IIF(DSPR.IsBuyOrSell = 1, DSR.DaysAccrued, 0) AS N(3)),
CAST(IIF(DSPR.IsBuyOrSell = 2, DSR.DaysAccrued, 0) AS N(3)),
* pre VFP9
IIF(DSPR.IsBuyOrSell = 1, DSR.DaysAccrued, 000),
IIF(DSPR.IsBuyOrSell = 2, DSR.DaysAccrued, 000)
>We have a query that's generating a weird result/error. Below is the sample:
>
>
>SELECT
>IIF(DSPR.IsBuyOrSell = 1, DSR.DaysAccrued, 0),
>IIF(DSPR.IsBuyOrSell = 2, DSR.DaysAccrued, 0)
>FROM Deal D
>INNER JOIN DealSide DSR ON D.SystemDealNumber = DSR.SystemDealNumber AND DSR.Side = 'R'
>INNER JOIN DealSideProduct DSPR ON DSR.SystemDealNumber = DSPR.SystemDealNumber AND DSPR.Side = DSR.Side
>INNER JOIN SystemParameters SP ON (1=1)
>WHERE EMPTY(D.OptionExpiration) AND D.Approved AND D.TerminationDate >= SP.LastDailyProcessing
>      AND ! INLIST(D.Product, 'SWAP', 'CAP', 'EQUITYOPTION')
>ORDER BY Grouping1 ASC, DealNumber ASC
>
>
>The second field is generating an error. When run in VFP itself, an asterisk appears as the value. When we run the select statement with only the second field, the query result is exactly as expected. If we change the second field to have 100 as the else value instead of 0, then it works. What could be causing this to happen?
>
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform