Error Message: Msg 8134, Level 16, State 1, Line 1480 Divide by zero error encountered.
What this error message tell us that we are trying to divide a numerator value by zero.
The best way to handle this kind of error in sql code is by using NULLIF or case statement.
USE NULLIF
Select Numerator/NULLIF(Denominator, 0) FROM table
In this above SQL statement, whenever Denominator is converted to 0 if there is missing value.
USE CASE Statement
Select CASE WHEN DENOMINATOR = 0 Then NULL ELSE Numerator/Denominator
FROM Table