I am officially retarded. I can't believe that I didn't know that the text equals operator "=" in SQL Server queries was case insensitive. I am not sure where I got this in my head, but I always assumed that "=" was case sensitive for text comparison and LIKE was case INsensitive. But in reality, these three SQL statements all return the same result:
SELECT id FROM address WHERE street1 = '123 Street St' SELECT id FROM address WHERE street1 = '123 STREET ST' SELECT id FROM address WHERE street1 = '123 StReEt sT'
Ugggg! To think of the times I have used LOWER() on a field to search for case insensitive text matches. Thank God I don't deal with too many queries that needed to do case insensitive searches (at least the fallout of my ignorance will not wreak too much havoc).
I just hate making mistakes like that or finding such glaring knowledge gaps :(
Want to use code from this post? Check out the license.