Question: how to calculate percentage in sql server without divide by zero error?
Answer: Use NULLIF function in the denominator with second argument value zero.
If the value of the first argument is also, zero, this function returns a null value. ... 
If the value of the first argument is not zero, it returns the first argument value and division takes place as standard values.