search within string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • inspireuk
    New Member
    • Jul 2007
    • 12

    search within string

    i have a table of phrases/words

    eg
    somebody
    someone
    find you

    is it possible to pass in a string to a SP

    eg
    somebody wants to find you

    and for it to find all the phrases/words contained that are in the original table.

    eg
    somebody
    find you

    thanks in advance for any help.

    Josh
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by inspireuk
    i have a table of phrases/words

    eg
    somebody
    someone
    find you

    is it possible to pass in a string to a SP

    eg
    somebody wants to find you

    and for it to find all the phrases/words contained that are in the original table.

    eg
    somebody
    find you

    thanks in advance for any help.

    Josh
    parse your string into variable(s) and then use that variable as filter condition...use WHERE searchkeyontabl e in (@var1, @var2, @var3...and so on)

    Comment

    • inspireuk
      New Member
      • Jul 2007
      • 12

      #3
      how would i parse the string into all the possible combinations? the phrases can be up to 4 words long

      J

      Comment

      • space1000
        New Member
        • Aug 2007
        • 10

        #4
        try the charindex command. Use the help (F1) to help you with the syntax

        Comment

        Working...