title: sql server 2008 stored proc optimization best practice of multiple or conditions
body: <p>Question pertains to performance and best practice. (sql server 2008 stored procedure)</p>
  
  <p>If a stored proc contains code like this</p>
  
  <pre><code>result = select count(*) from tableA where (some condition1)
  
  if (result) -- meaning we got something from above query
     return result
  else
     result = select count(*) from tableA where (some other condition2)
  and so on until
  result = select count(*) from tableA where (some other conditionN)
  </code></pre>
  
  <p>Is it better to put all the conditions in one big query like this</p>
  
  <pre><code>   resultn = select count(*) from tableA 
     where (condition1 or condition1 or... conditionN)
  </code></pre>
  
  <p>Will a table scan be done for every condition or is the table scan done once no matter how many conditions. What is an elegant way to handle this type of logic. thanks</p>