Just wondering about SQL Server Money data type:
------- SCRIPT 1
declare
@test table (
Seg varchar(1),
amt money
)
insert @test
select 'a', -427614103835526.00 union all
select 'a', -219289921481827.00 union all
select 'a', -169175063383313.00 union all
select 'a', -151094936902350.00 union all
select 'a', 522155575758567.00 union all
select 'a', 395662864132351.00 union all
select 'a', 187076841800608.00
select SUM(amt) from @test
------ SCRIPT 2
declare
@amt money
set @amt = 137721256088510.00
As you see, the script 1 will failed
Msg 8115, Level 16, State 2, Line 14
Arithmetic overflow error converting expression to data type money."
I tried to move the content to Excel and got the amount of the 2nd Script and it runs well. Is there any kind of explanation on this behavioral?