SQL Server: 2012 Introduce New Logical Function – IIF

SQL Server 2012 introduced new logical function called “IIF” and I am going to share basic syntax and use of this function.

The main purpose of this function is to check the Boolean condition. If condition is true, it returns a true value, otherwise it returns false value.

Using this function you can validate and return value in a single line of code and don’t require to use IF-ELSE.

The Syntax of IIF:

Example ONE:
Example TWO:
Example THREE:
Example of Nested IIF:
Anvesh Patel

Leave a Reply

1 Comment on "SQL Server: 2012 Introduce New Logical Function – IIF"

Notify of
Sort by:   newest | oldest | most voted

Hi i am kavin, its my first occasion to commenting anyplace, when i read
this article i thought i could also make comment due to this good piece of