Update to anyone following this: this compile-time exception to normal T-SQL CASE short circuiting[/url] is now scheduled to be fixed in an upcoming SQL release, thanks to Gianluca for filing...
Update: that exception to normal T-SQL CASE short circuiting[/url] should be fixed in an upcoming SQL release, per the Connect bug. It's still the behavior in SQL2005-SQL2008R2 (and maybe...
FWIW I think CASE's implementation actually does guarantee both order of execution and predictable short circuiting at execution time. That doesn't prevent this error, though, because in this case the...
This post seems to recommend CASE as a way to get deterministic short circuiting in T-SQL. Unfortunately, even CASE does not always provide deterministic order of evaluation with short circuiting....
Be ware that even CASE does not always provide deterministic order of evaluation with short circuiting. See http://bartduncansql.wordpress.com/2011/03/03/dont-depend-on-expression-short-circuiting-in-t-sql-not-even-with-case/[/url]. (It'll probably work for the example shown above, but be aware...