I have a website where I need to search for data and ignore all quotes.
- The search is not performed, dont or dont, and retrieves results for strings that have words that begin with: do not, dont or dont
- Search for "hello" or "hello" or welcome search results for lines that begin with the words: "hello", "hello" or hello.
Note. I am already removing quotes for passed in the search bar
I want to know if there is a simpler (or less verbose) method than:
select Name from tbl_MyTable where (Replace(Replace(Replace(Replace(Replace(Replace(Name,'"',''),''',''),'''',''),'"',''),''',''),'"','') like 'dont%' or Replace(Replace(Replace(Replace(Replace(Replace(Name,'"',''),''',''),'''',''),'"',''),''',''),'"','') like '% dont%' );
Right now, my best idea is to create a new column containing a quotation-delimited version (added by a space) so I can just do:
select Name from tbl_MyTable where FixedName like '% dont%';
But I really would like to know if this can be done without creating a new column and be efficient.