[egenix-users] "right truncation" warning in mx.ODBC.Windows

Steve Holden sholden at holdenweb.com
Thu Mar 11 10:39:35 CET 2004


[mal]
> Steve Holden wrote:
> > [mal]
> >
> >>>datestmp = mx.DateTime.localtime(time.time())
> >>
> >>Try to use a string here: '2004-03-11 10:00:00' and
> >>see whether that makes any difference (the ODBC driver could
> >>be having trouble with the seconds fraction - even though
> >>we've never heard of such problems with SQL Server before).
> >
> > I'm sorry, I thought this was well-known (and I also thought I had
> > reported it earlier. Maybe I invented that last piece of
> knowledge :-).
>
> Probably just dropped off my horizon: looking at the list
> archives, you are right. I wonder whether this only affects
> certain versions of the MS ODBC driver ?!
>
Well, good to know I *didn't* invent the report!

> If so, please provide us with the information from
>
> connection.dbms_version
> connection.dbms_name
> connection.driver_name
> connection.driver_version
>
Are these connection attributes a recent addition? My 2.0.5 doesn't have
them, nor any reference to them in the documentation. Or have I
misunderstood what I'm supposed to be reporting?

Anyway, from the ODBC driver info applet:

SQL Server; Version 2000.80.194.00; SQLSRV32.DLL; 8/6/2000

Frankly I'm amazed that Windows Update hasn't provided me with something
more recent. However, investigation reveals (amazingly) that I only have
the hot fixes. [... upgrades to sp3a ... aagghh, I hate service packs
... 1 hour later ...]  OK, now my driver is

SQL Server; Version 2000.81.9031.38; SQLSRV32.DLL; 3/11/2003

but sadly this doesn't seem to be any better:

Trying 2004-03-11 10:29:20.86
Oops! We trod on the driver!
["Warning: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional
truncation', 4579)\n"]
Trying 2004-03-11 10:29:20.00
That seemed to work

Maybe there's some option setting that will automatically truncate
fractional seconds, and I don't have it set? Can't find anything in the
documentation, though. FWIW, Transact-SQL docco says """Date and time
data from January 1, 1753 through December 31, 9999, to an accuracy of
one three-hundredth of a second (equivalent to 3.33 milliseconds or
0.00333 seconds). Values are rounded to increments of .000, .003, or
.007 seconds, as shown in the table.""", so it should be capable of
sub-second resolution. Perhaps it just doesn't like values that require
rounding?

> We can then look into adding code to truncate the fraction in
> timestamps for MS SQL Server ODBC drivers.
>
Well OK, I hope this helps.

regards
--
Steve Holden                                 http://www.holdenweb.com/
ReportLab Enterprise Publishing Solutions    http://www.reportlab.com/
Chairman, PyCON DC 2004                          http://www.pycon.org/
Telephone: +1-800 494 3119                        Fax: +1 703 278 8289





More information about the egenix-users mailing list