I have a problem with a query in ms sql server. I have a full text index on a column called "col1". The data in this column can get quite large (20, 30 kb +). I now want to search in this column for an exact phrase.
I have been told that the "contains" function is the fastest function for this, but I am aware of at least 2 other ways of doing this; using the "like" function, and using "charindex".
The problem is that "contains" doesn't work when I am searching for a phrase which contains a # symbol. For example, "... WHERE contains(col1, '"query string#"') ..." will always return 0 results.
I have switched to using charindex, and that does return results, but it takes a lot longer to query the database using this function.
Is there any way to either speed this query up or get the contains function to accept my # symbol?
Thanks for your time...
Update I've decided to switch between using charindex the contains function. So if the query data contains the # symbol, we switch to using charindex; for all other queries, I use the contains. Seems to work the best.