You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to filter on a datetime colum (u_sentinstant):
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/django_pyodbc/base.py", line 489, in execute
return self.cursor.execute(sql, params)
pyodbc.DataError: ('22007', '[22007] [FreeTDS][SQL Server]Conversion failed when converting date and/or time from character string. (241) (SQLExecDirectW)')
Code:
class Command(BaseCommand):
help = 'Sends email notifications'
def handle(self, *args, **options):
now = datetime.now()
all_open_port = EmailTable.objects.using('prod').filter(u_sentinstant__gte = datetime.today())
for p in all_open_port:
print(p.u_sentinstant)
self.stdout.write(self.style.SUCCESS('Successfully finished.'))
Tested on Fedora 25 using FreeTDS (TDS_Version 7.2 and 7.3) and unixODBC and Windows 10. Backend is SQL SRV 2014.
I am unable to filter on a datetime colum (u_sentinstant):
Code:
Tested on Fedora 25 using FreeTDS (TDS_Version 7.2 and 7.3) and unixODBC and Windows 10. Backend is SQL SRV 2014.
all_open_port.query:
It would work if milliseconds are removed and the string is in single quotes.
The text was updated successfully, but these errors were encountered: