Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Covert Nested Access IIF to CASE
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01435355
Message ID:
01435357
Vues:
27
>What's the correct syntax for converting this to SQL:
>
>
>IIf(IIf(CAST(RQ.RQ_JOB AS DECIMAL) < sf.PeriodOrderedQty, 0, CAST(RQ.RQ_JOB AS DECIMAL)- sf.PeriodOrderedQty) <> RQ.RQ_QTY_REQ,'Yes','') AS [Update PK Qty Required?], 
>
>
>Thanks


IIF translates to CASE statement, so
CASE when (case when CAST(RQ.RQ_JOB AS DECIMAL(19,4)) < sf.PeriodOrderedQty 
then 0 else CAST(RQ.RQ_JOB AS DECIMAL(19,4))- sf.PeriodOrderedQty end) = RQ.RQ_QTY_REQ 
then '' else 'Yes' end as  [Update PK Qty Required]
See also http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/always-include-precision-and-scale-with about why did I do another change (specified scale and precision for the decimal).
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform