IIF(...) not a recognized built-in function

Viewed 43765

I'm trying to use this in Microsoft SQL Server 2008 R2:

SET @SomeVar = @SomeOtherVar +
  IIF(@SomeBool, 'value when true', 'value when false')

But I get an error:

IIF(...) is not a recognized built-in function name

Is IIF() only compatible with a later version?

Is there an alternate function I can use?

4 Answers
Related