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 |
|
dnf999
Constraint Violating Yak Guru
253 Posts |
Posted - 2007-06-22 : 05:57:06
|
Hi I am running some percentage calculations and encounter a problem if i have 0/0 count:Example:select 0/0 Error:Msg 8134, Level 16, State 1, Line 1Divide by zero error encountered.How can i get this to output '0' when I have a 0/0 calculation? I need this to produce a 0 as my query will crash when I am calcuating other percentages within the same query.Thanks! |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-06-22 : 06:04:11
|
| select case when y = 0 then 0 else x/y end==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
dnf999
Constraint Violating Yak Guru
253 Posts |
Posted - 2007-06-22 : 06:24:51
|
| awesome.Thanks |
 |
|
|
|
|
|