Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF equalent in T-SQL
Message
De
06/08/2016 17:40:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01639189
Message ID:
01639191
Vues:
83
>>Hi All,
>>
>>how can i use this line Iif(Empty(thisform.txtID.Value),'.t.','CrsTable.ID=thisform.txtID.value') in T-Sql where clause?
>>
>>Thanks
>
>Solved myself :)
>
>WHERE vw_CrsStokhb.fiskodu = CASE WHEN @fiskodu is not null then @fiskodu ELSE vw_CrsStokhb.fiskodu END

If I read all the names right. you may consider a simpler alternative:

WHERE @fiskodu IS NULL OR vw_CrsStokhb.fiskodu = @fiskodu

(but, in fact, if you can anticipate the nullity of fiskodu before create or issue the SQL statement - it's a parameter, right? - then it shouldn't be necessary to put the condition inside the WHERE clause, and instead build the SQL statement from scratch, with or without the WHERE clause, thus considering the two hypothesis).
----------------------------------
António Tavares Lopes
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform