Home > SQL Server > IIF() Function in SQL Server 2012

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.

IIF

Of course, we can use nested IIF as well.

 

NestedIIF

About these ads
  1. Michael
    February 20, 2013 at 11:44 AM | #1

    nice example. :)
    good work..

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 95 other followers

%d bloggers like this: