Reputation: 340
I have a query which searches rows in a database for matching strings. An example row may be:
This is a row which contains a String
The query that I am currently running is syntactically identical to
SELECT table.column FROM table WHERE table.column LIKE "*String*"
although it returns every row where the text "string" is found, regardless of case.
Does MS Access 2010 have any sort of case sensitive string comparator that I should be using instead of this?
Upvotes: 2
Views: 2626
Reputation: 91376
You can use Instr:
SELECT t.FieldName
FROM Table t
WHERE ((InStr(1,[FieldName],"aB",0)>"0"));
Upvotes: 0
Reputation: 172448
You will have to resort to VBA methods, I'm afraid. Fortunately, VBA methods can be used in JET SQLs (although performance might not be the best). The VBA Instr
method allows you to specify the comparison mode (0 = binary = case-sensitive):
SELECT table.column FROM table WHERE INSTR(table.column, "String", 0) > 0
Upvotes: 3
Reputation: 1464
I think LIKE '*String*'
not LIKE "*String*"
See more LIKE condition in MS Access
Upvotes: 0