Negative SYBMONEY BUG

Bob Kline bkline at rksystems.com
Thu Sep 14 09:16:44 EDT 2000


On Thu, 14 Sep 2000, Koscheev Andrey wrote:

> Howdy,
> 
> Has anyone already mentioned that MONEY datatype is badly converted
> to char when money value is negative?
> 
> On my Sybase ASE, TDS 4.2, dblib, Linux value -400.00 is displayed
> as -399.9744 and -30000.00 is -29999.9744. When I am connected to
> the same server from Microsoft's isql_w everything works fine.
> 
> I think the problem is inside tds_money_to_string function. If
> someone could verify my guesses I would appreciate that.

Comparing the code for the JDBC driver to tds_money_to_string() in
freetds/src/tds/numeric.c, it looks as if the Java code avoids the
problem you describe, but introduces another.  Both MONEY and SMALLMONEY
types are defined to preserve accuracy to a ten-thousandth of a monetary
unit, but the JDBC driver in Tds.getMoneyValue appears to be discarding
the two least significant decimal digits of this precision.  Is this
intentional?  It seems like an (inappropriate) U.S.-centric view of
monetary values.

-- 
Bob Kline
mailto:bkline at rksystems.com
http://www.rksystems.com




More information about the FreeTDS mailing list