简体   繁体   中英

How to make SQL case sensitive

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?

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

I think you can add collate after the WHERE clause.

SELECT col FROM table  
WHERE col COLLATE Latin1_General_CS_AS = 'value'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM