From: Marcos P. <ma...@bu...> - 2004-06-12 12:29:58
|
It might be that the db server/api takes incorrect decisions about the type of the parameter... You may try casting the parameter: and symbol like cast(@s as varchar(100)) By the way, you might use sigle quotes around string constants, it is more portable (triple quotes around sql looks better too ;-) El jue, 10-06-2004 a las 15:18, Skip Montanaro escribi=F3: > Can someone explain why these two seemingly identical queries return > different results? Can't LIKE wildcards be given in parameter dictionari= es? >=20 > >>> c.execute('select distinct symbol, open_time, close_time,' > ... ' session_start, session_end, instrument= ' > ... ' from underlying_sessions' > ... ' where instrument =3D @i' > ... ' and symbol like "M%"', > ... {"@i": "E"}) > >>> len(c.fetchall()) > 402 > >>> c.execute('select distinct symbol, open_time, close_time,' > ... ' session_start, session_end, instrument= ' > ... ' from underlying_sessions' > ... ' where instrument =3D @i' > ... ' and symbol like @s', > ... {"@i": "E", > ... "@s": "M%"}) > >>> len(c.fetchall()) > 0 >=20 > Thanks, |