>I agree Joe, but can you tell me how did you find out about this? I had the
>same problem long time ago and I end up with Giustino's solution! Just want
>to learn how to find the best answer to my questions.
Figured it out :-)
If $1 is a String, it is escaped and quoted before putting it in the SQL
statement. So if $1 = "Joe's Test", it gets interpolated as 'Joe\'s Test'.
Therefore:
like '%$1%' --> like '%'Joe\'s Test'%' (invalid SQL)
like '%' + $1 + '%' --> like '%' + 'Joe\'s Test' + '%' (valid SQL)
-Joe Walnes