How do I compare list of integers with integer columns in sql server. For example I have a column statusid
as int
. I want to get the result where statusid
in 1,4,8,9
. I kept all these integers in string and operate with the column statusid as below but i am facing error there. This string may be hard coded or parameter.
where Cast(statusid as varchar) in ('1,4,8,9');
Please suggest the solution.