I'm having a problem with arithmetic overflow when converting to bigint in SQL Server 2008. The following is confusing me.
This works:
select 58356453 * 228204732751
Answer: 13317218761161292203
But, all other attempts that involve explicit conversion fail.
select convert(bigint, 58356453 * 228204732751)
result: arithmetic overflow
begin
declare @key bigint = 58356453,
@workingVal bigint,
@primeMultiplier1 bigint = 228204732751;
set @workingVal = @key * @primeMultiplier1;
end;
result: arithmetic overflow
What am I missing here? I've also tried "cast(BigNumber as bigint)" (don't think it's any different from convert), and various combinations of conversion before/after arithmetic operations.
And, this is on Windows Server 2008 x64