Reputation: 25
How to improve text search in sql without using like '%%' expression ,and make search faster
Upvotes: 2
Views: 503
Reputation: 9204
Haneen,
The link will show you what you need to do. Ultimately you need to add Full-Text indexes as Ziesemer pointed out. If you are wanting to query documents make sure to install the appropriate iFilters (PDF, Office Docs, etc).
Please see issues I ran into here with PDF searches using full-text indexing(hopefully this will save you some time if you plan on searching files)
--S
Upvotes: 0
Reputation: 28707
Use SQL Server's Full-Text Search feature:
In contrast to full-text search, the LIKE Transact-SQL predicate works on character patterns only. Also, you cannot use the LIKE predicate to query formatted binary data. Furthermore, a LIKE query against a large amount of unstructured text data is much slower than an equivalent full-text query against the same data. A LIKE query against millions of rows of text data can take minutes to return; whereas a full-text query can take only seconds or less against the same data, depending on the number of rows that are returned.
See also: How to enable Full-text Indexing in SQL Server 2005 Express?
Upvotes: 3