title: how to fix this Msg 8117, Level 16, State 1, Server WIN-ILO9GLLB9J0, Line 2 Operand data type varchar is invalid for avg operator
body: <p>I'm solving a hacker rank challenges and i'm stuck with an error </p>
  
  <blockquote>
    <p>Msg 8117, Level 16, State 1, Server WIN-ILO9GLLB9J0, Line 2 <br>
    Operand data type varchar is invalid for avg operator. </p>
  </blockquote>
  
  <p>kindly suggest the chnages</p>
  
  <p>I have tried writing this query   </p>
  
  <pre><code>SELECT CEILING((AVG(Salary))-(AVG(REPLACE(Salary,0,'')))) FROM EMPLOYEES
  </code></pre>
  
  <p>2061</p>