Skip to content
Advertisement

Find a word from a string in SQL Server

I have some values into a table like below :-

  1. Bank Of America
  2. testBank Of America
  3. State Bank Of India
  4. ICICI Bank
  5. Test @Bank*

I want a query to get all the values which contains Bank only. Proper word should match.

Result should be like :-

  • Bank Of America
  • State Bank Of India
  • ICICI Bank

Advertisement

Answer

One method is to add spaces to the beginning and end of the column and then look for ' Bank ':

where ' ' + col + ' ' like '% Bank %'
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement