Re: pyodbc - problem passing None as parameter

2009-10-23 Thread Tim Golden
Frank Millman wrote: Thanks, Tim, for the detailed explanation. I appreciate your taking the time. It was difficult for me to use the code that you posted, because under my present setup I define my SQL statements externally, and the WHERE clause has to conform to one or more rows of six colu

Re: pyodbc - problem passing None as parameter

2009-10-23 Thread Frank Millman
Tim Goldenwrote: > Frank Millman wrote: >> >> I want the final WHERE clause to show 'WHERE todate IS NULL'. > > Of course, I understand that. What I mean is that if a piece > of SQL say: > > WHERE table.column IS ? > > then the only possible (meaningful) value ? can have is > NULL (or None, in pyt

Re: pyodbc - problem passing None as parameter

2009-10-23 Thread Tim Golden
Frank Millman wrote: Tim Golden wrote: Frank Millman wrote: cur.execute('select * from ctrl.dirusers where todate is ?', None) Traceback (most recent call last): File "", line 1, in pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax

Re: pyodbc - problem passing None as parameter

2009-10-22 Thread Frank Millman
Tim Golden wrote: > Frank Millman wrote: >> > cur.execute('select * from ctrl.dirusers where todate is ?', None) >> Traceback (most recent call last): >> File "", line 1, in pyodbc.ProgrammingError: ('42000', >> "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax >> ne

Re: pyodbc - problem passing None as parameter

2009-10-22 Thread Tim Golden
Frank Millman wrote: I posted the following to the pyodbc google group, but got no reply - it seems a bit quiet there. I hope someone here can help. I am using pyodbc version 2.1.6 on Windows Server 2003, connecting to Sql Server 2005. This works - cur.execute('select ?', None) cur.fetc

pyodbc - problem passing None as parameter

2009-10-22 Thread Frank Millman
Hi all I posted the following to the pyodbc google group, but got no reply - it seems a bit quiet there. I hope someone here can help. I am using pyodbc version 2.1.6 on Windows Server 2003, connecting to Sql Server 2005. This works - >>> cur.execute('select ?', None) >>> cur.fetchall() [(No