jakesylvestre / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

MS SQL Server + FreeTDS, getting garbage instead of NULL date and datediff fields #366

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Here is code snippet that illustrates the problem:

row = cursor.execute("""
set nocount on
declare @field datetime
set @field = NULL
select
  @field as field,
  datediff(minute, @field, getdate()) as diff
""").fetchone()
assert row.field == None, 'pyodbc bug, returns garbage instead of null 
datetime' # fails here
assert row.diff  == None, 'pyodbc bug, returns zero instead of null datediff' # 
and here

os: CentOS release 6.5 (Final)
python: 2.7.2
pyodbc: 3.0.6
driver: freetds-0.82-NTLMv2-64
server: Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64)

Unfortunately, I'm quite restricted here and can't check other versions of 
pyodbc/driver.

Original issue reported on code.google.com by VFLa...@gmail.com on 9 Apr 2014 at 9:27