In SQL Server 2005, I have a product search that looks like this:
select ProductID, Name, Email from Product where Name = @Name
I was asked to ignore a couple of "special" characters in Product.Name, so the search for "Potato" returns "Pot-fingers" as well as "Potato". My first thought is to just do this:
select ProductID, Name, Email from Product where REPLACE(Name, '-', '') = @Name
... but, on the other hand, I wonder if I can kill performance by running a function on EVERY candidate. Does SQL have some kind of optimization magic that can help me deal with this quickly? Can you come up with something simpler, can I try with the requirements that I have?
dnord source share