In Sql Server 2005 when I have multiple parameters do I have the guarantee that the evaluation order will always be from left to right?
Using an exa
One way to control the evaluation order is with the CASE expression.
[Edit]
The popular opinion I was trying to express was:
You cannot depend on expression evaluation order for things like “WHERE OR “, since the optimizer might choose a plan that evaluates the second predicate before the first one. But order of evaluation of the expressions in a CASE statement is fixed, so you can depend on deterministic short circuit evaluation of a CASE statement.
It does get a bit more complicated than that as explained in the site below:
http://blogs.msdn.com/b/bartd/archive/2011/03/03/don-t-depend-on-expression-short-circuiting-in-t-sql-not-even-with-case.aspx