May 29, 2020  
 
Gaebler.com is a daily online magazine covering small business news. We help entrepreneurs transform ideas and innovations into greatness.

Articles for Entrepreneurs

 

SQL Productivity Tips

 

How to Make SQL Like Case Sensitive

Want to learn the simplest way to make SQL Like searches case sensitive? Here's the fastest way we found to do case sensitive SQL searches using WHERE and LIKE.

I realized that SQL is case insensitive when I tried to find articles in my article database that did not conform to proper case capitalization.
(article continues below)

For example, I knew there were a few URLs that contained the word "founder" with a lower case "f" when they should have been capitalized with an upper case "F" to be "Founder" and thus be consistent with the rest of the articles on our Entrepreneur Resources site.

So I hopped over to SQL Server and ran a query very similar to this:

SELECT * FROM ARTICLEDB WHERE ARTICLE_FILENAME LIKE '%-founder%'

Of course, I got back instances of URLs that contained both "-Founder" and "-founder" because SQL SELECT statements with SQL WHERE and SQL LIKE are by nature case insensitive.

I did a quick search for a fix to my SQL case problem, and discovered that this SELECT statement does the trick:

SELECT * FROM ARTICLEDB WHERE ARTICLE_FILENAME COLLATE Latin1_General_BIN LIKE '%-founder%'

Long story short, the way to make an SQL select statement case sensitive is to add in that "COLLATE Latin1_General_BIN" after the column name.

Why does it work? How does it work? What other ways are there to do it? I do not know and could care less.

If you want to truly understand this stuff, there are plenty of long articles on SQL case sensitivity.

If you just need a quick fix that works, try the above method to make an SQL SELECT case sensitive rather than case insensitive, which is the default.


Conversation Board

Dealing with SQL case sentitive issues? Feel free to ask a question. We also welcome any SQL tips and comments related to SQL select statements and case sensitivity.


Questions, Comments, Tips, and Advice  Code Image - Please contact webmaster if you have problems seeing this image code
Problem Viewing Image
Load New Code

 

 

Additional Resources for Entrepreneurs

Search Engine Marketing

Social Marketing Optimization

Business Forms

Business in the Jungle - Business in Fiction - Negotiating

Radio Ad Costs

Newspaper Advertising Rates

City-Specific Resources for Entrepreneurs

Small Business Insurance

Global Entrepreneurship

China & Entrepreneurs