Essi Shams
Essi Shams

Reputation: 159

MS Access 2010: String Wildcard character

I am using MS Access 2010 to run queries on a SQL Server Database using an ODBC connection.

Whenever I convert the tables involved in my query to local tables, my query only works if my string wildcard is the ACCESS standard wildcard of the * character.

However, if my query involves so much as a single linked table from the SQL DB, I have to change the wildcard character to the SQL standard of the % character for the query to work.

Is this indeed the case? Is there anyway around this so that I don't need to remember the wildcard character depending on whether I have linked or local tables?

Upvotes: 1

Views: 147

Answers (1)

HansUp
HansUp

Reputation: 97100

Is there anyway around this so that I don't need to remember the wildcard character depending on whether I have linked or local tables?

Access SQL supports ALike as an alternative to Like. The difference with ALike is that it signals the Access db engine to always expect ANSI wildcards (% and _ instead of * and ?).

So SELECT * FROM Foo WHERE some_field ALike 'a%'; will always return the same rows ... regardless of the context where it is run ... as long as the Access db engine is handling it.

Upvotes: 5

Related Questions