August 16, 2015 at 3:49 am
I have written a number of queries that use the intrinsic function IIf on a SQL Server 2012 instance. Now, I need to port these to an older, 2008 R2 instance. I found (after the fact) that 2008 R2 doesn't contain the IIf intrinsic function. Does anyone have a User Defined Function that will emulate the IIf function you're willing to share?
August 16, 2015 at 7:01 am
I strongly recommend you don't use a UDF. The performance overhead can be nasty, and you'll still have to change all your code, because UDFs have to be prefixed with their schema when called (dbo.IIF(...))
Rather convert the IIF expressions into a CASE.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply