Hi,
I have 2 SQL query like below.
1. select * from mytest where 'abc' LIKE mycol.
2. select * from mytest where mycol LIKE 'abc'.
"mytest" is a table with "mycol" a column in it. The table has records with "mycol" containing values with SQL Server wild card e.g. %, %%, %a% etc.
The query "1" returns me all 3 records with %, %% and %a% as "mycol" values, whereas query "2" does not return any record.
I am looking for an explanation how does 2 query works? What are the differenes between the two queries? Seems like the wild card values stored in "mycol" column are behaving like a wild card instead of literal when matching to literal 'abc' in case query "1".
Thanks,
Sachin