I had an arithmetic overflow problem when converting to bigint in SQL Server 2008. The following is confusing to me.
It works:
select 58356453 * 228204732751
Answer: 13317218761161292203
But all other attempts involving 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 also tried "cast (BigNumber as bigint)" (I donβt think it is different from conversion) and various combinations of conversion before / after arithmetic operations.
And this is on Windows Server 2008 x64
sql-server sql-server-2008
user542516
source share