Closed happy322 closed 2 years ago
You need to provide far more details about your environment.
Please provide a minimal reproducible example.
Python: 3.8.10 pyodbc: 4.0.32 OS: Win 10
Query that doesn't work correctly:
SELECT * FROM Table WHERE Table.Name LIKE ‘*[a-z]*’;
This request is executed directly through the ms access request constructor, but when I send it through pyodbc the response is not correct.
By default the Access UI uses *
and ?
wildcards, whereas Access ODBC uses the ANSI wildcards %
and .
for LIKE statements. So, with pyodbc you should use
sql = "SELECT * FROM my_table WHERE my_table.name LIKE '%[a-z]%'"
By default the Access UI uses
*
and?
wildcards, whereas Access ODBC uses the ANSI wildcards%
and.
for LIKE statements. So, with pyodbc you should usesql = "SELECT * FROM my_table WHERE my_table.name LIKE '%[a-z]%'"
Oh, thx! It’s work!
I need help with the following question. When sending a sql query via MS Access, I get the data I'm interested in. But when I try to send the same request via pyodbc I get an empty response.
I think the problem is in this piece of code: WHERE ([Table name].Name LIKE ‘[a-z]’) OR …