Monday, February 13, 2012

arithmetic operations with money and real

Hallo,
as far as I remember the result of an arithmetic operation
in SQL Server 2000 is implicitly casted to the higher ranked
data type.
In SQL Server 7.0 real is higher than money so that every
multiplication or divison of a money and real value is real.
I think this is valid for SQL Server 2000 too.
My new project includes some very high money values and I
have a lot of multiplications (percentage up to 100) and
divisions (by rates of exchange).
So is it a good idea to cast explicitly every real value to
a money value in arithmetic operations like?
Klaus
www.trappdata.dehi,
you must be aware that when you do something with real datatype, in some
cases you may loose precision. even if it is a cent, it may matter to
someone.
peter
"Klaus Trapp" <Klaus.Trapp@.gmx.de> wrote in message
news:uKnj9hFSGHA.1780@.TK2MSFTNGP12.phx.gbl...
> Hallo,
> as far as I remember the result of an arithmetic operation
> in SQL Server 2000 is implicitly casted to the higher ranked
> data type.
> In SQL Server 7.0 real is higher than money so that every
> multiplication or divison of a money and real value is real.
> I think this is valid for SQL Server 2000 too.
> My new project includes some very high money values and I
> have a lot of multiplications (percentage up to 100) and
> divisions (by rates of exchange).
> So is it a good idea to cast explicitly every real value to
> a money value in arithmetic operations like?
>
> Klaus
> www.trappdata.de|||Klaus,
Money and real?. This is not a good combination because real is an
approximate number.
See is this can help.
monney vs numeric
http://groups.google.com/group/micr...r />
t=0&num=3
AMB
"Klaus Trapp" wrote:

> Hallo,
> as far as I remember the result of an arithmetic operation
> in SQL Server 2000 is implicitly casted to the higher ranked
> data type.
> In SQL Server 7.0 real is higher than money so that every
> multiplication or divison of a money and real value is real.
> I think this is valid for SQL Server 2000 too.
> My new project includes some very high money values and I
> have a lot of multiplications (percentage up to 100) and
> divisions (by rates of exchange).
> So is it a good idea to cast explicitly every real value to
> a money value in arithmetic operations like?
>
> Klaus
> www.trappdata.de
>

No comments:

Post a Comment