Are boolean expressions in SQL WHERE clauses short-circuit evaluated ?
For example:
SELECT * FROM Table t WHERE @key IS NULL OR (@key IS NOT NULL
From the above, short circuiting is not really available.
If you need it, I suggest a Case statement:
Where Case when Expr1 then Expr2 else Expr3 end = desiredResult
Expr1is always evaluated, but only one of Expr2 and Expr3 will be evaluated per row.
Expr1
Expr2
Expr3