| Author |
Topic |
|
maevr
Posting Yak Master
169 Posts |
Posted - 2008-06-30 : 05:07:04
|
| select 1/2select 1/2.0The above produces different result based on decimals.The problem is that field2 contains zero and nulls so that divide by zero problem arises, but sqrt should not return zeros.select 5 / sqrt(0.49 * "field2")from SS_FBHow can I get past this? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-30 : 05:13:39
|
| select ISNULL(5 / NULLIF(sqrt(0.49 * "field2"),0),0)from SS_FB |
 |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-06-30 : 05:13:50
|
| Hi,Replace 0, Null with 1 in the Column Field2 |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-06-30 : 05:14:05
|
use case statement.case when field2 <> 0 then . .. else NULL end KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-06-30 : 05:19:44
|
quote: Originally posted by ranganath Hi,Replace 0, Null with 1 in the Column Field2
replacing with 1 will let it pass but the result will be misleading right ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-30 : 05:32:04
|
quote: Originally posted by ranganath Hi,Replace 0, Null with 1 in the Column Field2
better to show the result as 0 rather than just showing numerator value. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-06-30 : 05:36:16
|
in my opinion, best is to leave it as NULL.  KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-30 : 05:40:34
|
quote: Originally posted by khtan in my opinion, best is to leave it as NULL.  KH[spoiler]Time is always against us[/spoiler]
in that case you wont require the ISNULL also |
 |
|
|
maevr
Posting Yak Master
169 Posts |
Posted - 2008-06-30 : 06:48:38
|
| Thanks for your help, I made a case handling the 0. |
 |
|
|
|