[egenix-users] problem with mx.ODBC MS SQL-server and datetime

Max M maxm at mxm.dk
Thu Feb 7 13:56:37 CET 2002


I am trying out mx.ODBC on MS sql server, and so far it goes along nicely.

But I am having trouble with inserting dates ie. from mx.DateTime
The error message is:
('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation',
4479)

The only thing i could find on the net was (one line only):

http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2

Where somebody has the same problem:

"Marc-Andre answer:
Looks like MS SQL Server's ODBC driver is being too careful again.
What you are seeing there is a SQL warning which mxODBC translates
into an exception."

the advice is "recompiling the package with -DDONT_REPORT_WARNINGS"

I would find it a lot easier to just catch the exception. But I cannot 
see from the traceback which exception to catch.  So I have made a quick 
hack:

        try: # it bitches about dates
            c.execute(qs, localValues)
        except:
            pass

That's about as dirty as it gets. So I wondered what the better way to 
do it is? As far as i can tell it just raises a general exception. Not 
one that I can catch explicitly.

Do I really have to re-compile? And if so what is needed?

regards Max M




More information about the egenix-users mailing list