Converting SQL Server data types.

Gerhard Häring gerhard.haering at gmx.de
Tue Mar 4 15:16:11 EST 2003


sismex01 at hebmex.com wrote:
> Hello yalls :-)
> 
> I've a problem.  When running some database queries and
> formatting results, I found that some columns are type
> "money", and these arrive as a tuple of integers,
> as this:
> 
>     (0, 1364570710)

Strange. Which database module is this that you're using?

> 
> when it should in fact read as:
> 
>     136457.0710
> 
> So... how do I convert from type MONEY to type FLOAT,
> inside python?  I wouldn't want to have to modify the
> dbase side, but if there's no other way I'll do it
> (rather than do 200+ reports by hand, again...)

If t is the tuple, t[1] * 10000.0 will work for this particular sample 
tuple.

-- Gerhard






More information about the Python-list mailing list