Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Conversion
Message
 
 
À
29/09/2011 13:11:30
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01525186
Message ID:
01525187
Vues:
68
You can replace IIF with CASE T-SQL function
iif(month(receiveddate)=7,amount,000000000000.00)
(CASE WHEN month(receiveddate)=7 THEN AMOUNT ELSE CAST(0 AS numeric(12,2) END)
Also check PIVOT type of queries


>Hello all, I am porting a VFP app to NET and SQLServer. I have a fairly complex SQL SELECT that I need to rewrite to be compatible with SQLServer 2008. It includes some lines like this:
>
>select ;
>	sum(iif(month(receiveddate)=7,amount,000000000000.00)) as jul, ;
>	sum(iif(month(receiveddate)=8,amount,000000000000.00)) as aug, ;
>	sum(iif(month(receiveddate)=9,amount,000000000000.00)) as sep, ;
>
>So far I have not been able to figure out how to work the IIF statements into the new code. Can someone give me some ideas here?
>Thanks
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform