How to make SQL case sensitive

时光毁灭记忆、已成空白 提交于 2020-01-28 09:56:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!