Archive

Archive for December 23, 2011

New function in SQL SERVER DENALI (IIF)

December 23, 2011 Leave a comment

Hello friends,

As a continuation of Denali exploration series

(http://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

Follow

Get every new post delivered to your Inbox.

Join 38 other followers