tags:

views:

47

answers:

2

Hi,

What does this mean within my like statement?

LIKE '%[ .,!?]' + keyword + '[ .,!?]%'

I'm trying to get something, that will match for whole words

+4  A: 
LIKE '%[ .,!?]' + keyword + '[ .,!?]%'

means

find anything that meets these conditions:

  • Is preceded by a space, comma, exclamation, question mark
  • Matches the keyword
  • Is followed by a space, comma, exclamation, question mark
openshac
also, don't forget that the % will match any chars on the start and end
krock
A: 

Just remember that this will lead to a full table/index scan, if your table is large you may need to rethink.

Raju