title: Why does casting AVG(intger_column) as DECIMAL return a minimum of six decimal places?
body: <p>Consider this query:</p>
  
  <pre><code>WITH Scores (score)
       AS
       (
        SELECT CAST(score AS INTEGER)
          FROM (
                VALUES (0), 
                       (10), 
                       (10)
               ) AS Scores (score)
       )
  SELECT AVG(CAST(score AS DECIMAL(19, 8))) AS precision_eight, 
         AVG(CAST(score AS DECIMAL(19, 7))) AS precision_seven, 
         AVG(CAST(score AS DECIMAL(19, 6))) AS precision_six, 
         AVG(CAST(score AS DECIMAL(19, 5))) AS precision_five, 
         AVG(CAST(score AS DECIMAL(19, 4))) AS precision_four
    FROM Scores;
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>precision_eight | precision_seven | precision_six | precision_five | precision_four 
       6.66666666 |       6.6666666 |      6.666666 |       6.666666 |       6.666666 
  </code></pre>
  
  <p>Why do I always get a minimum of six decimal places? Is this documented behaviour? </p>
  
  <p>(I'm running SQL Server 2008)</p>