troubleshooting Question

T-SQL

Avatar of gringogordo
gringogordo asked on
Microsoft SQL ServerMicrosoft SQL Server 2005SQL
7 Comments1 Solution226 ViewsLast Modified:
Hi I'm writing a search query where I am trying to check a large field (varchar (4000)) for specific words.  As I understand it I can't use Full text indexing as I can't index the field.  Oh SQL Server 2005 by the way!

I want to look for individual words including plural.  This doesn't have to be too sophisticated so I am treating any punctuation as a space.  Currently for on a search for 'August' I have

(([SearchField] Like'%[^a-z]August[^a-z]%'
OR [SearchField] Like 'August[^a-z]%'
OR [SearchField] Like      '%[^a-z]August'
OR [SearchField] Like '%[^a-z]August[s][^a-z]%'
OR [SearchField] Like 'August[s][^a-z]%'))

This is doing exactly what I want but I am allowing multiple words and treating each word as an or so the search is very slow when there are 4 or 5 words.  Can anyone recommend a better use of pattern matching criteria to achieve the same ends ?  Or possibly an alternative strategy.

Thanks.  

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros