Link to home
Start Free TrialLog in
Avatar of Favourites
Favourites

asked on

Is Immediate If available in Sql Server ?

In Access there is a function called Immediate If ( IIF) which has the same functionality as ternary operation (?:) in C. I want to know whether there is a similar function in SQL Server.
Avatar of cymbolic
cymbolic

Nope, the closest you can come to conditional expression is in the use of the where and having clauses on your select statements, or use of IF/Else, Case, When/Then expressions.

Your best source for info if you have installed SQL Server client utilites is in SQL Server Books online, assuming you had enough space to install those as well.
Avatar of Favourites

ASKER

This is not what we are looking for.
We need to use the equivalent function of IIF(MS- Access2.0)
 in MS-Sql Statements.

Like for eg. DECODE function in oracle.

select decode(a.field1>30,a.field2,decode(a.field1<20,a.field3,a.field4))
from table1 a
where <condition>
ASKER CERTIFIED SOLUTION
Avatar of connex
connex
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
good. I am able to solve the problem thru the answer u gave me. Thanks a lot.