Closed COngstad closed 5 years ago
This is an issue I'm aware of. I had started working on supporting this here, but just haven't had time to finish it.
If you can point me in the right direction of what needs to be completed I'd be happy to try and finish this up.
I have a fix for this merged to master. I'll try and get a release out to pypi in the next few days.
Fixed in 1.10.0
It seems that the microseconds from a datetime2 column do not get converted properly and at times get rounded.
`import ctds
sql="""select cast('2018-12-11 17:19:30.641' as datetime2),cast('2018-12-11 17:19:30.642' as datetime2),cast('2018-12-11 17:19:30.997' as datetime2)"""
con_args={'server':'localhost','port':1433,'user':'sa','xxxx':'password','xxxx':'xxx','timeout':86400}
conn=ctds.connect(**con_args)
cursor=conn.cursor()
print conn.tds_version
cursor.execute(sql)
print tuple(cursor.fetchone())`
produces the following result
7.4 (datetime.datetime(2018, 12, 11, 17, 19, 30, 640000), datetime.datetime(2018, 12, 11, 17, 19, 30, 643000), datetime.datetime(2018, 12, 11, 17, 19, 30, 997000))