Converting SQL Server data types.

sismex01 at hebmex.com sismex01 at hebmex.com
Tue Mar 4 15:15:23 EST 2003


> From: Gerhard Häring [mailto:gerhard.haering at gmx.de]
> Sent: Tuesday, March 04, 2003 2:16 PM
> 
> 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

argh... another victim of not seeing the trees for the
leaves... :-P

I'm accessing the database directly vía win32com.client.Dispatch
using ADODB.Connection objects.

Hmmm... it seems that I need to check my results better...
and get eyeglasses, maybe. :-)

Thanks Gerhard.

-gustavo





More information about the Python-list mailing list