In my SQL Server table called AAA I have field called BBB containing strings full of wild cards:
&abc##v
_&abc##&&
_&abc##_12
_&abc##%
I need to allow user to search for partial matches on this field.
User's search phrase will contain lots of wild cards.
What is the best approach for this problem?
I guess I could write something like:
select * from AAA where BBB like '%' +
(add escape character to every wild card found in user's question) + '%'
escape 'whatever char is not being used in user's question'
But I do not like this idea. Is there any better one?