March 22, 2011 at 9:38 am
Use ref
Update a
set HF56390 =
Convert(Numeric(9,2),4.00*HC85230,0)/HF00340*100
From H_PRO_QF a,H_FAVG_Q b,H_I_QP c
Where a.Key = b.Key and a.Key = c.Key and
a.Pedate = b.Pedate and a.Pedate = c.Pedate and a.status = 1
While i am running the above query, getting divide by zero error
March 22, 2011 at 9:43 am
assumning if that field HF00340 is zero, you want to set that result to zero, else the calcualtion:
Update a
set HF56390 =
CASE
WHEN HF00340 = 0
THEN 0
ELSE Convert(Numeric(9,2),4.00*HC85230,0)/HF00340*100
END
From H_PRO_QF a,H_FAVG_Q b,H_I_QP c
Where a.Key = b.Key
and a.Key = c.Key
anda.Pedate = b.Pedate
and a.Pedate = c.Pedate
and a.status = 1
Lowell
March 22, 2011 at 9:47 am
Thanks a lot
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply