WHERE Clause with OR operator: are both statements execd?

  • I could not find this in BOL: in a query like

    SELECT col FROM table WHERE cond_1 OR cond_2.

    When cond_1 is TRUE will SQL Server check if cond_2 is TRUE? And if this is correct, is there a way to prevent this?

    Thank you for your attention,

    Gerry


    Dutch Anti-RBAR League

  • It should only evaluate to the first true condition in an OR chain.

  • I've had BAD experiences with this.

    If an index is to be used for one of the columns on the where clause, sometimes that expression is evaluated FIRST so the chain evaluation order is not actually from left to right 

     

     

     


    * Noel

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply