SQL SELECT question...

Dmitry Rozmanov dima at xenon.spb.ru
Fri May 19 18:23:58 EDT 2000


I think your problem is that in SQL string literals are like 'string'
not "string", and 'str%' instead "str*" for LIKE. At least I had such a
problem at first. 

So try: 
	"SELECT sf FROM st WHERE sf='ss'"
or
	"SELECT sf FROM st WHERE sf='%s'" % "ss"

Hope this helps.

	---Dmitry.

Rob Elder wrote:
> 
> Hello, guys
> 
>    I'm struggling with using SQL with Python. One question please. How
> should I structure the following operation using odbc:
> 
> cursor.execute('SELECT someField FROM someTable WHERE someField="someString"')
> 
> This does not work for me. How is this supposed to be structured?
> 
> TIA.
> 
> -r



More information about the Python-list mailing list