title: Simple way to prevent a Divide By Zero error in SQL
body: <p>I have a SQL query which used to cause a </p>
  
  <blockquote>
    <p>Divide By Zero exception</p>
  </blockquote>
  
  <p>I've wrapped it in a <code>CASE</code> statement to stop this from happening. Is there a simpler way of doing this?</p>
  
  <p><strong>Here's my code:</strong></p>
  
  <pre><code>Percentage =  CASE WHEN AttTotal &lt;&gt; 0 THEN (ClubTotal/AttTotal) * 100 ELSE 0 END
  </code></pre>