0

I'm new to SQL and I don't know how to do this and I didn't find any useful thread for me so I decided to ask.

Is there any possibility to replace this:

WHERE [Index] like '%9007870355%' OR
      [Index] like '%9005200803%' OR
      [Index] like '%9005780887%' OR
      [Index] like '%9007040256%' OR
      [Index] like '%9005200845%'

With something with the intention of

[Index] like %values from column in some table%

I'm trying to do this in my c# program to let user adding these indexes, and then take them from some table in my query, instead of editing query every time when some new index arrives.

apaderno
  • 28,547
  • 16
  • 75
  • 90
Mati
  • 389
  • 3
  • 6
  • 16

1 Answers1

4

To implement

[Index] like '%values from colum in some table%' 

do this:

join someTable on [Index] like '%' + someTable.someColumn + '%'
Bohemian
  • 412,405
  • 93
  • 575
  • 722