January 8, 2010 at 6:54 am
We are trying to decide if we should use Money or Decimal(9.2) for our currency columns and are wondering why MS created Money datatype if decimal produces more accurate results?
January 8, 2010 at 7:20 am
if i am not mistaken the money type placse the $ infront of the number where as decimal does not
January 8, 2010 at 7:23 am
after looking it does not put the $ inf ront of the number but try this little script and then rethink your question.
declare @int money
declare @int2 decimal(9,2)
set @int = '88.5555555555555666666666666'
set @int2 = 88.55555555555556666666666666
select @int, @int2
which is more accurate
January 8, 2010 at 7:31 am
Quoting Books online..
The money and smallmoney data types are accurate to a ten-thousandth of the monetary units that they represent.
Ans it does not represent currency symbol...
Blog -- LearnSQLWithBru
Join on Facebook Page Facebook.comLearnSQLWithBru
Twitter -- BruMedishetty
January 8, 2010 at 7:51 am
What is being presented to me is the following SQL:
DECLARE @dOne DECIMAL(10,2),
@dThree DECIMAL(10,2),
@mOne MONEY,
@mThree MONEY,
@fOne FLOAT,
@fThree FLOAT
SELECT @dOne = 1,
@dThree = 3,
@mOne = 1,
@mThree = 3,
@fOne = 1,
@fThree = 3
SELECT @dOne = @dOne/@dThree*@dThree ,
@mOne = @mOne/@mThree*@mThree ,
@fOne = @fOne/@fThree*@fThree
SELECT @dOne AS DecimalResult,
@mOne as MoneyResult,
@fOne as FloatResult
produces DecimalResult = 1.00
Money Result = .999999
FloatResult = 1
January 8, 2010 at 8:02 am
I've avoided money as I'm not sure if provides benefits over the numeric types. It also limits me, and I prefer to not be limited. I let the application handle the decisions on formatting and presentation.
January 18, 2013 at 12:38 pm
well said, I agree 100%
January 18, 2013 at 12:56 pm
The money data type is not an MS construct.
It came over with the original Sybase SQL Server code.
January 18, 2013 at 1:02 pm
The results you are getting have to do with rounding rules.
They may be related to accounting rounding rules.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply