Case Sensitive or Insensitive SQL Query
Suppose you need to perform a SQL query and you need for it to be case sensitive or case insensitive, and either your database is set up the opposite way or you're smart and you're trying to write your query so that it will work regardless of how the database may or may not be configured. For instance, consider this query: SELECT UserId, email FROM UserInfo WHERE email = 'ashvin@padhiyar.com' If your database contains an email for Bill like this one: ASHVIN@padhiyar.com then whether or not your query will return any rows will depend on the COLLATION for the database. If you want to ensure that you DO get results, you can force it to use a CASE INSENSITIVE collation like so: SELECT UserId, email FROM UserInfo WHERE email = 'ashvin@padhiyar.com' COLLATE SQL_Latin1_General_CP1_CI_AS Similarly, if you don't want it to return any rows unless you specify the correct case for the email, you would change the collation to replace _CI_ with _CS_ where CI is shor...