Closed GoogleCodeExporter closed 8 years ago
I found a partial answer to this problem. Using the LIKE Statment with the
PYODBC connection - you must use a '%' as a wildcard. Although the '%'
wildcard doesn't work when executing a SQL statment in Access manually. This
is very strange why the wildcard value changes in the 2 SQL statments. '*'
works in Access SQL and '%' works in PYODBC SQL.
Original comment by darryl.k...@gmail.com
on 18 Jan 2012 at 6:25
This is normal. The correct wildcard is '%', but Access changes it when using
the Access UI.
Original comment by mkleehammer
on 23 Jun 2012 at 9:47
Hi, can you help me?
This code works for me:
cursor.execute("SELECT Zadání FROM tab1 WHERE Zadání Like '%something%';")
But this one doesn't work, and i don't know why.
X='%something%'
cursor.execute("SELECT Zadání FROM tab1 WHERE Zadání Like ?;",X)
Am i doing something wrong?
Btw, great work with that module, you save my school project. ZIZA
Original comment by jakub.zi...@seznam.cz
on 28 Apr 2013 at 5:41
Not sure what you are trying to do with the ?;"
But I think you want to try this instead
X = '%something%'
cursor.execute("SELECT Zadani FROM tab1 WHERE Zadani LIKE %s;" % X)
Original comment by darryl.k...@gmail.com
on 28 Apr 2013 at 11:32
Yeah, that is what i meant, it works now, Thank you very much for your time.
Original comment by jakub.zi...@seznam.cz
on 29 Apr 2013 at 2:08
The "?" is a placeholder for cursor to sanitize inputs from SQL injection
attacks I believe, so switching to "% X" could possibly open up a vulnerability.
Original comment by dhel...@gmail.com
on 16 Dec 2013 at 9:40
Original issue reported on code.google.com by
darryl.k...@gmail.com
on 18 Jan 2012 at 6:00