0

I have column in my table that contains the values like that:

1,3,4,2,6,5

I want to check all the values in the above column..

how to do it??

I want to run the query like ths:

select * from table where column contains 1,2,3,4,5,6

I tried to use like operator but it does not work if column has without sequence values..

miken32
  • 42,008
  • 16
  • 111
  • 154
Gaurav Gupta
  • 491
  • 3
  • 7
  • 20

1 Answers1

0

That's not very efficient, but will do:

select 
    * 
from [table]
where ','+ '1,2,3,4,5,6' +',' like '%,'+ cast(column as varchar(255)) +',%'
AdamL
  • 12,421
  • 5
  • 50
  • 74