IIF() Function in SQL Server 2012
In this post we will discuss about IIF() Function.The IIF function means “Immediate IIF”.IIF is a shorthand way for writing a CASE expression.This functions take three arguments. If the first argument is true, it will return the second argument as result or it will return the third argument as result.
IIF can be nested as well, IIF statements can also be nested only up to the maximum level of 10.
Declare @Gender char(10)='M' select IIF(@Gender='M','Male','Female') as Result --Second Example--- DECLARE @a int = 5, @b int = 4; SELECT IIF ( @a > @b, 'TRUE', 'FALSE' ) AS Result
One reply on “IIF() Function in SQL Server 2012”
“Appreciate you sharing, great blog article.Thanks Again. Really Cool.”