问题
I have an Access database set up on a domain hosting service. I am connecting to it through SQL. However, I need all of my queries to be case sensitive, and as far as I know the way the server is set up on the hosting service is it's NOT case sensitive. Is there a certain command that I could use in my SQL which would make the query case sensitive?
回答1:
I think you can add collate after the WHERE clause.
SELECT col FROM table
WHERE col COLLATE Latin1_General_CS_AS = 'value'
回答2:
Do you need to set the entire DB to case sensitive, or is it just part of some queries. If it is a query term then you can use these to force case sensitive matching:
StrComp("A","a",0)
The 0 in the method signature is to perform a binary comparison giving you the case sensitivity you want. It returns an integer.
WHERE StrComp('myText1', 'MYTeXt1', 0) = 0
Documentation
来源:https://stackoverflow.com/questions/5747698/how-to-make-sql-case-sensitive