freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Smallmoney and money rounded to 2 decimals?
- From: Frediano Ziglio <freddy77 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Smallmoney and money rounded to 2 decimals?
- Date: Thu, 12 Apr 2018 08:41:35 +0100
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] Smallmoney and money rounded to 2 decimals?,
Sebastien FLAESCH, 04/06/2018
-
Re: [freetds] Smallmoney and money rounded to 2 decimals?,
Frediano Ziglio, 04/12/2018
- Re: [freetds] Smallmoney and money rounded to 2 decimals?, Fredy Paquet, 04/12/2018
-
Re: [freetds] Smallmoney and money rounded to 2 decimals?,
Sebastien FLAESCH, 04/12/2018
-
Re: [freetds] Smallmoney and money rounded to 2 decimals?,
Frediano Ziglio, 04/16/2018
- Re: [freetds] Smallmoney and money rounded to 2 decimals?, Sebastien FLAESCH, 04/16/2018
-
Re: [freetds] Smallmoney and money rounded to 2 decimals?,
Frediano Ziglio, 04/16/2018
-
Re: [freetds] Smallmoney and money rounded to 2 decimals?,
Frediano Ziglio, 04/12/2018
Archive powered by MHonArc 2.6.24.