Thanks for the response.
I tried '= null'. It does not give a syntax error, but it (correctly)
returns an empty result set, even though there are rows which contain
nulls. I can confirm that by typing the query directly into Sql Server
Management Studio. If I type 'is null' it returns three rows, if I
type '= null' it returns zero rows.
I don't know if this helps, but I ran an ODBC trace of the SQL
command. Here is the relevant part (sorry about the long lines, but
this is what it produces) -
================================
python cbc-c6c ENTER SQLPrepare
HSTMT 00C926B8
UCHAR * 0x00987BBC [ -3] "select * from
ctrl.dirusers where todate is ?\ 0"
SDWORD -3
python cbc-c6c EXIT SQLPrepare with return code 0
(SQL_SUCCESS)
HSTMT 00C926B8
UCHAR * 0x00987BBC [ -3] "select * from
ctrl.dirusers where todate is ?\ 0"
SDWORD -3
python cbc-c6c ENTER SQLNumParams
HSTMT 00C926B8
SWORD * 0x0021FCC4
python cbc-c6c EXIT SQLNumParams with return code 0
(SQL_SUCCESS)
HSTMT 00C926B8
SWORD * 0x0021FCC4 (1)
python cbc-c6c ENTER SQLDescribeParam
HSTMT 00C926B8
UWORD 1
SWORD * 0x00AC7528
SQLULEN * 0x0021FC58
SWORD * 0x0021FC54
SWORD * 0x0021FC50
python cbc-c6c EXIT SQLDescribeParam with return code -1
(SQL_ERROR)
HSTMT 00C926B8
UWORD 1
SWORD * 0x00AC7528
SQLULEN * 0x0021FC58
SWORD * 0x0021FC54
SWORD * 0x0021FC50
DIAG [07009] [Microsoft][ODBC SQL Server Driver]Invalid Descriptor
Index (0)
DIAG [42000] [Microsoft][ODBC SQL Server Driver]Syntax error or
access violation (0)
================================
I have found a workaround (I leave 'is null' in the SQL statement,
without trying to parameterise it), so there is no urgency on this,
but I would be interested to know if there is a solution.
For the record, psycopg2 with Postgresql handles this with no problem.
Thanks again
Frank