问题
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?
回答1:
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
回答2:
I think LIKE '*String*'
not LIKE "*String*"
See more LIKE condition in MS Access
回答3:
You can use Instr:
SELECT t.FieldName
FROM Table t
WHERE ((InStr(1,[FieldName],"aB",0)>"0"));
来源:https://stackoverflow.com/questions/33277646/case-sensitive-searching-in-ms-access