Stored Procedure Pass String Array for IN Clause
Posted on 2006-03-24
I am trying to figure out if it is possible to pass a string array ie.(1,2,3,4) into a stored procedure parameter ie (@sList)
so that I dont have to build a SQL string dynamically from my C# code.
It would work as follows:
CREATE PROCEDURE my_stored_procedure_call
WHERE id IN(CAST(@sList AS int))
I continuously get "Error converting data type varchar to int". Has anyone ever been successful in doing this through a stored procedure.
Please note that the example above is extremely simple compared to what I am actually trying to query, but the concept is the exact same.