Strange LINQ to SQL Behavior
- by mcass20
What is wrong with the last query? Is it a bug or am I missing something?
This query returns 2 records (correct):
query = query.Where(Log => SqlMethods.Like(Log.FormattedMessage, "%<key>Name</key><value>David</value>%"));
This query returns 2 records (correct):
query = query.Where(Log => SqlMethods.Like(Log.FormattedMessage, "%<key>Name</key><value>%David%</value>%"));
This query returns 0 records (correct):
query = query.Where(Log => SqlMethods.Like(Log.FormattedMessage, "%<key>Name</key><value>av</value>%"));
This query returns 2 records (correct):
query = query.Where(Log => SqlMethods.Like(Log.FormattedMessage, "%<key>Name</key><value>%av%</value>%"));
This query returns 0 records (correct):
query = query.Where(Log => SqlMethods.Like(Log.FormattedMessage, "%<key>Name</key><value>v</value>%"));
This query returns 15 records (incorrect, should return 2):
query = query.Where(Log => SqlMethods.Like(Log.FormattedMessage, "%<key>Name</key><value>%v%</value>%"));