freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Sokol, Ryan - 244" <ryans AT HA.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] MONEY type support??
- Date: Mon, 18 Dec 2006 07:18:01 -0600
Thanks for the info.
-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of ZIGLIO,
Frediano, VF-IT
Sent: Monday, December 18, 2006 3:42 AM
To: FreeTDS Development Group
Subject: Re: [freetds] MONEY type support??
> > From: Sokol, Ryan - 244
> > Sent: Friday, December 15, 2006 1:43 PM
> >
> > I ran both of your queries through tsql and isql (unixODBC's tool)
> > on my Linux box and saw the rounding problem.
>
> I'm not sure I'd call it a "problem". It could be a feature, letting
> you not round things off to the nearest penny. "Money"
> doesn't usually
> imply fractions of a penny; if you need that, you need a
> floating point
> or exact numeric type.
>
> > What case were you
> > in to not see the rounding?
>
> I used Microsoft's osql.exe and Query Analyzer. It seems they do not
> round MONEY types when converting them to strings.
> Microsoft's isql.exe
> rounds to 2 places.
>
> I want to emphasize this is not standardized. T-SQL itself rounds to
> two positions:
>
> 1> select cast(cast(.116 as money) as varchar(30))
> 2> go
>
> ------------------------------
> 0.12
>
> One way around it, as you observed, is to convert to NUMERIC first.
>
> > Unfortunately, it looks like everything from FreeTDS in ODBC mode
> > automatically gets converted to a string.
>
> No, the driver certainly doesn't convert anything unless
> asked. Likely
> you're seeing PHP behavior, about which I don't know very much.
>
>From
http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc.c?revision=1.196
&view=markup
you can see that PHP convert anything except BLOBs to SQL_C_CHAR. Our
ODBC driver convert MONEY -> SQL_C_CHAR with 2 decimal digits (like MS
one). So... it's a feature, not a bug :)
Regards
Frediano Ziglio
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
-
[freetds] MONEY type support??,
Sokol, Ryan - 244, 12/15/2006
- <Possible follow-up(s)>
-
Re: [freetds] MONEY type support??,
Lowden, James K, 12/15/2006
- Re: [freetds] MONEY type support??, Sokol, Ryan - 244, 12/15/2006
-
Re: [freetds] MONEY type support??,
Lowden, James K, 12/15/2006
-
Re: [freetds] MONEY type support??,
michael . peppler, 12/18/2006
-
Re: [freetds] MONEY type support??,
Sokol, Ryan - 244, 12/18/2006
-
Re: [freetds] MONEY type support??,
James K. Lowden, 12/18/2006
- Re: [freetds] MONEY type support??, Sokol, Ryan - 244, 12/19/2006
-
Re: [freetds] MONEY type support??,
James K. Lowden, 12/18/2006
-
Re: [freetds] MONEY type support??,
Sokol, Ryan - 244, 12/18/2006
- Re: [freetds] MONEY type support??, Sokol, Ryan - 244, 12/18/2006
-
Re: [freetds] MONEY type support??,
michael . peppler, 12/18/2006
-
Re: [freetds] MONEY type support??,
ZIGLIO, Frediano, VF-IT, 12/18/2006
- Re: [freetds] MONEY type support??, Sokol, Ryan - 244, 12/18/2006
Archive powered by MHonArc 2.6.24.