August 8, 2018 at 12: What I say, is that you can't have a condition inside case statement.
February 15, 2015 at 11: Perhaps you could explain what you're after in a different way? Mel Pama says: Well, I'll answer the former directly, and invite hypotheses for the latter.
IIF is a function that I expected to fall into this same trap, but this function is really just a searched CASE expression with only two possible outcomes, and no ELSE — so it is tough, without nesting and introducing other functions, to envision a scenario where this can break unexpectedly. I've been caught by several of these in the past, but will try and remember lessons from this post in the future.
Issues that hit product support over and over should be fixed in the product.
One of the few limitations of the CASE expression is that is restricted to 10 nest levels. The preferred option, in my opinion, is to try and coerce SQL Server to evaluate the condition once though this isn't always possible within a single query.
An interesting side note: Logically, each non-deterministic function should be invoked once per row per instance of that function. After the subquery runs, it passes the results back to the outer query.
I tried something like that: Mark Sinkinson Mark Sinkinson 7,764 3 29 47. Here is an example:. Longitude 'Long', sqrt b.