all groups > sql server dts > january 2005 >
You're in the

sql server dts

group:

ARITHABORT OFF Not working in DTS


ARITHABORT OFF Not working in DTS Kayda
1/5/2005 10:06:20 PM
sql server dts: Hi:

I have a script below, when I run it on its own, it is great, but when I run
it as an "Execute SQL" task as part of a DTS package, the step fails with a
"division by zero" error. Shouldn't it ignore this error due to setting
ANSI_WARNINGS and ARITHABORT both to OFF? I get the error in Query Analyzer,
but it ignores it and moves on, just setting the result column to NULL when
there is a divide by zero, as it should.

Thanks,
Kayda
________________________________________________________________

INSERT INTO ASFinal (WeekEnding, AgentLogin, AgentName)
SELECT WeekEnding, AgentLogin, AgentGivenName + ' ' + AgentSurName AS
AgentName
FROM AgentInformation
GO

SET ANSI_WARNINGS OFF
SET ARITHABORT OFF
GO
UPDATE ASFinal SET
Corp_Calls = T2.TotalCallsAnswered,
Corp_TotalTalkTime = T2.TotalTalkTime,
Corp_AvgTalkTime = T2.TotalTalkTime / T2.TotalCallsAnswered,
Corp_Manned_Time = T2.TotalMannedTime
FROM
ASFinal T1, ASMain T2
WHERE
T1.WeekEnding = T2.WeekEnding AND
T1.AgentLogin = T2.AgentLogin AND
T2.Skillset = 'SC_Corp_Sk'

RE: ARITHABORT OFF Not working in DTS Alejandro Mesa
1/6/2005 5:55:01 AM
Try,

....
Corp_AvgTalkTime = T2.TotalTalkTime / nullif(T2.TotalCallsAnswered, 0),
....



AMB

[quoted text, click to view]
Re: ARITHABORT OFF Not working in DTS David Portas
1/7/2005 10:37:08 PM
I think the DTS step will always fail on a Division By Zero condition. To
avoid this, try changing your expression as follows:

...
corp_avgtalktime = T2.totaltalktime / NULLIF(T2.totalcallsanswered,0)
...

This will substitute NULLs for zeros and won't throw an error.

--
David Portas
SQL Server MVP
--

AddThis Social Bookmark Button