dbTalk Databases Forums  

ARITHABORT OFF Not working in DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss ARITHABORT OFF Not working in DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kayda
 
Posts: n/a

Default ARITHABORT OFF Not working in DTS - 01-06-2005 , 12:06 AM






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'



Reply With Quote
  #2  
Old   
Alejandro Mesa
 
Posts: n/a

Default RE: ARITHABORT OFF Not working in DTS - 01-06-2005 , 07:55 AM






Try,

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



AMB

"Kayda" wrote:

Quote:
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'




Reply With Quote
  #3  
Old   
David Portas
 
Posts: n/a

Default Re: ARITHABORT OFF Not working in DTS - 01-07-2005 , 04:37 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
--



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.