New function in SQL SERVER DENALI (IIF)

Hello friends,

As a continuation of Denali exploration series

(https://indiandotnet.wordpress.com/2011/09/23/see-beyond-the-sql-server-2005-latest-version-of-sql-server-denali/ )

I would like to share some new functions also here. I am sure you like shorthand function “IIF”. Denali now providing IIF function so Instead of writing CASE statement you can easily use IIF function.

 Its syntax is same as we doing in our other programming language.

 IIF (Condition, true value, false value)

 Example:-

DECLARE @genderMale AS BIT
 SET @genderMale = 1 -- where SELECT IIF (@genderMale = 1,’ Smart’, ‘Beautiful’) as property

 

I hope you will use it soon.
Happy Holidays!!!!


Thanks
Rajat Jaiswal

Advertisements

One thought on “New function in SQL SERVER DENALI (IIF)

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 )

Google+ photo

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

Connecting to %s