0

I tried a SELECT with a WHERE clause searching for a wrong string but the result showed the right string, which further testing showed the WHERE clause with the = operator doesn't return the exact match.

I have tried to search for solutions but can't find any through Google or Stack Overflow.

Simplified example

SELECT * 
FROM LoginCredential 
WHERE UserID = 'ad' 

The result

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

2 Answers2

0

You question appears to have already been asked and has an answer here How to do a case sensitive search in WHERE clause (I'm using SQL Server)?

For your easy reference:

SELECT *
From LoginCredential
WHERE UserID = 'ad'  COLLATE SQL_Latin1_General_CP1_CS_AS
Stephen Quan
  • 21,481
  • 4
  • 88
  • 75
  • 2
    In that case flag the question as a duplication rather than answering it again. – Dale K Feb 27 '23 at 03:33
  • Thank you, this solved my problem. Although I had seen the linked answer before, I do not understand the terminology then, sorry for the duplicate question. – Lazy Student Feb 27 '23 at 09:21
-3

If you are using MySQL, looks like you create a DB in case insensitive, like utf8mb4_general_ci, ci means case insensitive, change to utf8mb4_general_cs (case sensitive)

  • 3
    The SQL Server and SSMS tags that are on the question pretty much tells you that they're not using MySQL. – Ken White Feb 27 '23 at 03:29