rounding numbers when multiply

Last Post 14 Aug 2012 09:58 AM by richard forhire. 2 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages Not Resolved
dbandee
New Member
New Member

--
30 Apr 2012 08:26 AM
good morning
i have two fields both numeric (25, 9)
when multiplied it rounds up to 9 decimal points but everything after 6 decimal points is zeros
For example 52877978.753456789 * 0.069481091 produces 3674019.653665000

any thoughts?

thanks
Ninotna
New Member
New Member

--
03 May 2012 04:30 AM
Try this : CAST(CAST(@a AS float) * @b AS numeric(25,9))

Conceptually, the result should be a numeric(50, 18), this is above SQL Server's maximum precision, so the result would need to be truncated. So the numeric(50,18) is actually converted to numeric(38, 6).

richard forhire
New Member
New Member

--
14 Aug 2012 09:58 AM
--curiously ...

declare @v1 numeric(25,9) = 52877978.753456789
select @v1 * 0.069481091

--3674019.653664997721076799


Acceptable Use Policy
---