search / word boundaries / RLIKE ??

  • Hello. I'm used to MySQL which has RLIKE and REGEXP. I'm trying to write a search engine with SQL Server, but I don't know how to specify "word boundaries" using LIKE. For example, when I write:

    select * from products where long_desc like '%table%'

    ...I get back products with "adjustable" or "portable" in their descriptions. I also need to consider descriptions that begin with the word "table", for example.

    How can this be done with SQL Server?

    Thanks!!!

  • If you are looking for words that starts with table, then use LIKE 'table%'

    If you are looking for words that end with table, use LIKE '%table'

    I'm not sure what you're asking, please clarify if this doesn't answer the question.

     

     

  • If you add a full text index to your table you can use the CONTAINS command to pick out indiviual words. 

    See "Using the CONTAINS Predicate" in Books on line for more info.

     

  • Excellent. Full-Text indexing is what I need. Too bad I have to ask an expensive admin to turn it on for me. Ugh.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply