Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to convert IIF to SQL Server SQL Select
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 6.5 and older
Divers
Thread ID:
01356167
Message ID:
01356176
Vues:
27
SUM( CASE WHEN MYTABLE.STATUS IN('O','C') and MYTABLE.TYPE = 'AM' THEN 1 ELSE 0 END) as OPEN_PM 
>
>I don't think SQL Server supports IIF() function. And I need to convert the following expression in my VFP-type SQL Select to SQL Server:
>
>
>sum( iif( ( MYTABLE.STATUS = "O" or MYTABLE.STATUS = "C" ) and MYTABLE.TYPE = "AM", 1, 0 )) as OPEN_PM 
>
>
>How do I do it so that it works when passing the expression to SQL Server (via SPT)?
>
>P.S. I forgot to change the default version of SQL Server when creating this message. I am using SQL Server 2005.
>
>UPDATE/SOLUTION: CASE.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform