Link to home
Start Free TrialLog in
Avatar of mainrotor
mainrotor

asked on

I get a division by 0 error in SQL Server query

Hi,
I get a division by 0 error in my sql server query.  How do I fix this error in my query?

Thanks in advance,
mrotor
Avatar of Sean Stuber
Sean Stuber

what is the query?
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@sdStuber

I guess, since I'm more familiar with Access, I prefer to test for a NULL or 0 as the denominator and set the result to NULL, before attempting the Division.

Yes, X/NULL = NULL, so it would not be averaged, but I guess from my perspective (still getting used to some of SQL Servers quirks), the case statement is more readable.

Dale