开发者

How to make SQL case sensitive

开发者 https://www.devze.com 2023-02-27 11:00 出处:网络
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开发者_JAVA技巧 as I know the way the

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开发者_JAVA技巧 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'
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号