1

I want to pass multiple values using stored procedure ?

select * from Mytable where column1 in ('aa','bb','cc')

now i want to passed these column1 parameters using stored procedure

how can i do that?

Neo
  • 15,491
  • 59
  • 215
  • 405

1 Answers1

2

Try with this:

SELECT * 
FROM Mytable
WHERE CHARINDEX(',' + CAST(Column1 AS varchar) + ',', @YourParameter)  > 0
Milen
  • 8,697
  • 7
  • 43
  • 57
  • Another note here: `@YourParameter` should start and end with `,` otherwise will miss the first and the last item from your list of comma separated values. – Milen Dec 20 '13 at 12:34