10-24-2012 06:49 AM
Hi,
Just trying to run the following query, it was working for a while, suddenly started getting "Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int." Any suggestion please?
Solved! Go to Solution.
10-24-2012 07:16 AM
You're going to have to CAST the item to a bigger int
SUM(CONVERT(bigint,SS.ItemSize))
10-24-2012 06:56 AM
Funny enough if I change the query date range to today's date it works! However i have been using the same last few weeks with 2012-12-12 and it used to work before.
10-24-2012 07:16 AM
You're going to have to CAST the item to a bigger int
SUM(CONVERT(bigint,SS.ItemSize))
10-24-2012 07:16 AM
My suggestion would be that this:
SUM(SS.ItemSize)/1024
isn't returning an integer.
10-24-2012 07:21 AM
The explanation is that an INT can grow to 2,147,483,647 and you are THEN dividing by 1024, so thats basically 2TB it can count up to in a regular INT, a BigInt goes up to 9,223,372,036,854,775,807 which is 8 zettabytes, and I don't think you'll get close to that size at any given point
10-24-2012 07:24 AM
Thanks
SUM(CONVERT(bigint,SS.ItemSize)) worked perfectly as archived Data is just over 2TB now for that particular archive :)
Thanks again for your help, really appreciate!