Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about porting IIF() to SQL Server
Message
 
 
À
06/10/2001 22:08:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00565233
Message ID:
00565235
Vues:
15
The CASE function in SQL Server is an analog of IIF() function in VFP. It would affect performance the same way as any other T-SQL function.
SELECT < field list >, 
        SUM( CAST WHEN InvType='01' THEN Qty * UnitPrice ELSE 0 END) AS TotDollars...
>Question...
>
>I'm porting some VFP queries into SQL server, and have a question about embedding IIF() functions...
>
>I have a VFP query where I'm summing certain fields based on an Invoice type. In VFP, I do the following
>
>SELECT , SUM(IIF(InvType='01',Qty * UnitPrice,0)) AS TotDollars...
>
>What is the best way to do this in Transact-SQL? The only thing I've come across that would seem to work is a SELECT CASE statement in the query, though my question is how much this would affect performance when working on a large file.
>
>Thanks,
>Kevin
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform