Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use an iif in T_select
Message
From
06/03/2012 11:42:48
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01537399
Message ID:
01537403
Views:
41
>Hi.
>I want to select from avtable , based on a Parameter (Say X)
>e.g. If Parameter = Blank, select all records, else select where a Filed eqauls parameter value
>
>In VFP, following works:
>SELECT * FROM MyTable WHERE IIF(X= " ",.t.,REF == X)
>
>Can something similar be done in Sql (Above simplified version... I could have 5 Where conditions)
>Tia
>Gerard


I would use a CASE statement:

SELECT CASE x
WHERE '' THEN true
WHERE .. THEN ..
WHERE .. THEN ..
ELSE X

END AS myField
Previous
Reply
Map
View

Click here to load this message in the networking platform