IIF() Function in SQL Server 2012
Eventually, SQL Server offered the IIF() function. The IIF function means “Immediate IIF” and not “Inline IIF”, that’s how SQL Server defines it. Doesn’t matter as long as we have it in T-SQL. Now, we can avoid using complicated CASE statement.
IIF function accepts three parameters. First parameter is an expression, which returns True or False. If it returns True, the second parameter value is returned else for False, the third parameter value is returned.
Of course, we can use nested IIF as well.