Skip to Content.
Sympa Menu

freetds - Re: [freetds] Smallmoney and money rounded to 2 decimals?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Fredy Paquet <fredy AT opag.ch>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Smallmoney and money rounded to 2 decimals?
  • Date: Thu, 12 Apr 2018 10:23:15 +0200

The original Sybase drivers have a similar problem. Sybase internally
calculates with 4 digits, but all text export (BCP) routines render
only 2 digits.

On Thu, 2018-04-12 at 08:41 +0100, Frediano Ziglio wrote:
> 2018-04-06 12:59 GMT+01:00 Sebastien FLAESCH <sf AT 4js.com>:
> > Hi all,
> >
> > Using FreeTDS 1.00.9:
> >
> > When fetching a smallmoney or money data, SQLDescribeCol() returns
> > the sqltype SQL_DECIMAL, precision 10 for smallmoney and or 19 for
> > money and a scale of 4 for both types, which is fine, since
> > smallmoney
> > and money can store 4 decimal digits.
> >
> > Using an SQL_C_CHAR buffer to hold the values, we see that the
> > decimal
> > part is rounded to 2 digits...
> >
> > Is this expected?
> >
> > using other ODBC drivers for SQL Server we get 4 decimal digits.
> >
> > Is there some configuration settings to control this?
> >
> > Thanks!
> > Seb
>
> Just checked. Yes, apparently Microsoft ODBC drivers format money
> with
> 4 decimal digit.
> I think in the past tools used 2 digits but they moved to 4 along the
> way.
> There's actually no way to change that behavior but probably there
> should be.
> The 2 digits code is currently quite hard coded in src/tds/convert.c
> and src/tds/numeric.c.
> I suppose a good way would be to add a flag to TDSCONTEXT (which is
> used during conversion to pass locale information).
>
> Frediano
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> https://lists.ibiblio.org/mailman/listinfo/freetds
--
Fredy Paquet
Mitglied der Geschäftsleitung
OPAG Informatik AG
Fabrikmattenweg 11
CH-4144 Arlesheim
http://www.opag.ch
Tel. ++41 61 716 92 22
Fax. ++41 61 716 92 29

Attachment: smime.p7s
Description: S/MIME cryptographic signature




Archive powered by MHonArc 2.6.24.

Top of Page