IIF()
IIF(): IIF is a function which returns true or false depending upon the Boolean expression given. It needs 3 parameters viz. Boolean Expression, returning value if condition is true, returning value if condition is false.
Syntax of IIF():
IIF ( boolean_expression, true_value, false_value )
Example of IIF():
DECLARE @var1 INT= 25;
DECLARE @var2 INT= 20;
SELECT IIF( @var1 > @var2,'TRUE','FALSE')AS Output;
The output will be TRUE.
IIF() method is like .Net’s Conditional operator which is used to validate Boolean expression and return first value if expression is true else the other value.
For complete post go to SQL Server 2012 Enhancements.