[egenix-users] Datetime field overflow

Izzet Ergas Izzet.Ergas at citrix.com
Wed Aug 25 11:26:07 CEST 2010

I'm getting this error when querying a MS SQL Server 2005 instance with the SQL Native client using mxODBC 3.0.4.

Error: 22008, 0, [Microsoft][SQL Native Client]Datetime field overflow, 7748

I don't always get the error, it only seems to happen for some values passed to the query. I think it is somehow related to the fact that a mx.DateTime object is being passed to the query and somehow being converted to a SQL datetime field in an improper manner.

In the query below SessionIdTime is a datetime field in SQL and I'm passing last_record[0] which is a mx.DateTime object. Not sure how to workaround this issue.

Any ideas?

sql = """
    sd.SessionIdTime, sd.SessionIdSeq
FROM SessionDetails sd
WHERE sd.SessionIdTime > ?
    OR (sd.SessionIdTime = ? AND sd.SessionIdSeq > ?)
 db = mx.ODBC.Windows.DriverConnect('DSN=OCS')
 conn = db.cursor()
 conn.execute(sql, (last_record[0], last_record[0], last_record[1]))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20100825/88016402/attachment.htm

More information about the egenix-users mailing list