Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
skourangi
Starting Member
7 Posts |
Posted - 2006-05-16 : 16:13:50
|
Hi,I get a divide by zero error message in SQL Server 2000 in my query.Does anyone know what is the best way to handle it?Thank you! |
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-16 : 16:37:21
|
Let the query be executed when the Deviding field(s) are not zeroSelect F1/(DF1 * DF2) from Urtbl where DF1 <> 0 and DF2 <> 0 and <ur other conditions>Srinika |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2006-05-16 : 16:47:20
|
orSelect case when DF1<>0 and DF2 <> 0 then F1/(DF1 * DF2) else <SomeDefaultValue> end from Urtbl where <ur other conditions>CoreyCo-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..." |
|
|
skourangi
Starting Member
7 Posts |
Posted - 2006-05-17 : 11:47:13
|
Thanks for your reponse.I used the Nullif function which worked because I had a verylong subquery that I didn't want to make longer. |
|
|
sshelper
Posting Yak Master
216 Posts |
|
|
|
|