Sudantha Sudantha - 2 months ago 8
SQL Question

Wildcard characters sql only alphabet characters

I need to create a rule only for alphabet characters

i used the following Wildcard character sequences but didn't work !


LIKE '[A-Za-z]'

LIKE 'a-z'

LIKE 'A-Za-z'

gbn gbn
Answer

Double negative like

WHERE
  SomeCol NOT LIKE '%[^a-z]%'

Ignoring the first NOT, this means "match any character not in the range a to z".

Then, you reverse using the first NOT which means "don't match any character not in the range a to z"

Edit, after comment

LIKE '%[a-z]%' means "find any single character between a-z. So 111s222 is matched for example because s matches in this like.