title: Alternative to relying on execution order of conditions in SQL 'where' clause
body: <p>In languages such as JavaScript you can have 2 conditional statements and "protect" the second one with the first one. For instance:</p>
  
  <pre><code>if( scarryObject != null &amp;&amp; scarryObject.scarryMethod() ) { ... }
  // if scarryObject is null scarryMethod will not be called
  </code></pre>
  
  <p>I thought I would achieve the same in SQL like so:</p>
  
  <pre><code>where int_date &gt; 19500101
      and month(CONVERT(smalldatetime, ... int_date))
  </code></pre>
  
  <p>The problem here is that if <code>int_date</code> is some "bad" value like -1, 0, 1 the conversion will fail and the sp will stop with an error. I thought the first check <code>int_date &gt; 19500101</code> would get evaluated first and if false the second condition would be skipped.</p>
  
  <p>It seems like it does not work like this... or? Is there any other way of doing this?</p>
  
  <p>Thanks!</p>