please someone help me to solve this issue:
I have this select:
SELECT Cast(( Isnull(price, 0) + Isnull(notarycosts, 0)
+ Isnull(landtax, 0) + Isnull(othertaxes, 0)
+ Isnull(agentfee, 0) + Isnull(cadastralfee, 0)
+ Isnull(tabulationfee, 0)
+ Isnull(certsarcini, 0) ) / ( totalareasqm / 10000 * fixhist ) AS
DECIMAL(12, 4)) AS EurPerHa
Sometime i’m getting a divide by zero error and my app it’s blocked until i delete the last row from the database.
Could I solve somehow this issue?
Thanks!
Either
TotalAreaSqmorFixHistis 0. As we cannot divide by zero, what should your script do when a zero exists?I usually see approaches of either make it NULL or use a known value to make it work. I have no idea what a safe value would be.
Make it null approach