1

Now for my thesis project i need to make a lot of queries like the below

select * from tblMyTable where ItemName like '%item%'

Now my question : is that possible to create indexes for such queries ? If so what is the way of doing it ? Thank you.

2 Answers 2

4

For LIKE queries this is not available.

But for making such queries SQL Server provides functionality called Full-text search. More info in MSDN.

2
  • So when i set full-text search will i be able to still use the query above ? Or i need different format ? Feb 21, 2012 at 14:02
  • You will need a different format and you will need to use Filltext-specific functions to achieve needed result. Also result will be language-specific to your database. Please refer to MSDN: Querying SQL Server Using Full-Text Search for further information. I do understand that might be not what you're looking for but that's the best SQL Server can offer for handling such needs. Feb 21, 2012 at 15:21
0

index will work if you have something like

where ItemName like 'item%'

also contains works much faster than like, see this: http://www.docstoc.com/docs/2280727/Microsoft-SQL-Server-70-Full-Text-Search-What-is-full-text-search

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.