I'm getting an "Arithmetic overflow error converting expression to data type int" error when running a simple aggregate function (see code below). As I throttle back the date range, I can see that the results is in fact exceeding the INT data type limit...I've tried casting the whole expression into a BIGINT w/o success. Anyone know how I can resolve this issue?
All 3 of these queries throw the same above mentioned error:
Select (SUM(ACDTalkTimeInSec) + SUM(TotAcwTimeInSec) + SUM(HoldTimeInSec)) as AHT
From ColTelephony.dbo.vwACDSkillCombined acd
Where WorkDte between '1/2/2018' AND '10/5/2018'
Select CAST(Cast(SUM(ACDTalkTimeInSec) AS BIGINT) + CAST(SUM(TotAcwTimeInSec) AS BIGINT) + CAST(SUM(HoldTimeInSec) AS BIGINT) AS BIGINT) as AHT
From ColTelephony.dbo.vwACDSkillCombined acd
Where WorkDte between '1/2/2018' AND '10/5/2018'
Select Cast(((SUM(ACDTalkTimeInSec) + SUM(TotAcwTimeInSec) + SUM(HoldTimeInSec))) AS BIGINT) as AHT
From ColTelephony.dbo.vwACDSkillCombined acd
Where WorkDte between '1/2/2018' AND '10/5/2018'