paul wrote:
> Frank Millman schrieb:
> > If you want it to handle a variable number of values, you will have to
> > programmatically construct the sql statement with the appropriate
> > number of parameters.
Yes, I should have made it clear it was the variable part that was
hard.
> >>> vals = (1,2,3,4,5)
> >>> sql = "select * from table where value in ("+','.join("?"*len(vals))+")"
> >>> print sql
> 'select * from table where value in (?,?,?,?,?)'
Argh, I have a scripting language and I'm not building up strings
dynamically? What an idiot.
Thanks, that's just what I needed.
--
http://mail.python.org/mailman/listinfo/python-list