title: Assign quotient or longer expression to local (real) variable T SQL
body: <p>Was floored to learn this, surely I am making and error...</p>
  
  <p>If I <code>DECLARE</code> a real (or decimal) local variable I can't assign (<code>SET</code>) the value of an expression?  I have to set to a value first then step through the expression.  If I try to "do the math" all at once I get <code>0</code>.</p>
  
  <p>So, this works..</p>
  
  <pre><code>DECLARE @HitRate real
  SET @HitRate = 805499
  SET @HitRate = (@HitRate / 847125) * 100
  --SET @HitRate = (805499 / 847125) * 100  --But this does not work?
  SELECT @HitRate
  </code></pre>
  
  <ul>
  <li>If I comment out the first 2 <code>SET</code> statement and just use the the third I get <code>0</code></li>
  <li>If I use all <code>3</code>, I get <code>0</code></li>
  <li>If I <code>CAST(@HitRate As DECIMAL(9,2))</code> I get <code>0</code></li>
  </ul>