-2

is there any way to write SQL query where we can perform contains Check on a column to a sub query/function

i.e. in this manner

select * from where COLUMN contains IN (select * from func)

or

select * from where '%'+ COLUMN + '%' IN (select * from func)  
Cœur
  • 37,241
  • 25
  • 195
  • 267
prasadhkumar
  • 11
  • 1
  • 1

2 Answers2

2

Try This,

Select * From  table_name A
Where Exists (Select *  From table_name B 
                 Where B.Column Like '%' + A.Column +'%')
Palanikumar
  • 6,940
  • 4
  • 40
  • 51
0

Reviewed my answer because I seem to misunderstood the question

    Select a.*
    from foo a,
    (select * from func) b
    where a.id = b.id or a.id like '%'+convert(varchar,b.id)+'%'

This will select records where A result set column id is equal or like %b.id%

evictednoise
  • 587
  • 1
  • 7
  • 19