Divide by zero error encountered RRS feed

  • Question

  • Hello, I have a line of script that occasionally  returns a 'divide by zero error':

    CAST SUM(a.mydata1) / CAST(SUM(a.mydata2) AS NUMERIC(10,2)) AS NUMERIC (10,0)) AS [AVERAGE TIME]

    Is there anything I can do here to amend this to bring through NULL - or 0 - in the instances when the above script is trying to calculate 0 / 0  - which it sometimes does?

    Any help appreciated - thanks

    Thursday, August 29, 2019 7:15 AM


All replies