[egenix-users] How to do "where foo in ?" clause in mxodbc?

Cliff Xuan Cliff.Xuan at artsalliancemedia.com
Tue Apr 15 17:15:25 CEST 2008


Hi there,

I am trying to do this in mxodbc, but apparently it doesn't work. Would really appreciate if someone can enlighten me.

>>> names = ('Andy','Bob', 'Charlie')
>>> sql = "select * from customer where firstname in ?"
>>> cur.execute(sql, (names,))
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
ProgrammingError: ('37000', 0, '[Microsoft][ODBC SQL Server Driver]Syntax error or access violation', 4504)

The objective is to be able to use the SQL "in" clause, e.g. select * from customer where firstname in ('Andy','Bob', 'Charlie').

Many thanks,
Cliff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20080415/ce3fba33/attachment.htm


More information about the egenix-users mailing list