What LINQ query can I write to perform a case sensitive match on two varchar columns when I do not have the option of changing or adding to the database schema?
I've considered using COLLATE, but understand that this is not possible with LINQ. Is this correct?
Alternatively, I could use the CONVERT function to match VARBINARY values, but don't know how that can be implemented with LINQ.
Before marking this as a duplicate, consider that I'm looking for a LINQ query and not any solution that involves changing or adding to the database schema.
You could try:
table.Where(_ => _.col1 == "seArch").AsEnumerable().Where(_ => _.col1 == "seArch");
First Where will use SQL server's COLLATE which will return case insensitive results, 2nd where will use case sensitive search.