Many times when doing mass updates or query reports, we run into situations where a "divide by zero" error occurs. Sure, we can put all sorts of error trapping and the like, but there may be conditions where the value we are using to divide is zero. Add a miniscule value to the field that may be zero.
(profit/(prfinv+.0001) ) *100
It doesn't affect the calculation and protects from program crashes. The same method can be applied when using a calculated value in SQL.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment