In my stored procedure I am passing a filter (using “WHERE Column IN” clause) as a parameter. The value of the parameter is given as CSV. What is the best method to convert this CSV in to a record set.
Example:-
SELECT *
FROM Employee
WHERE Name IN ('John','Joe','Jerry','James')
and I need to pass the names as a parameter which is a CSV string like
"John,Joe,Jerry,James"
.
Take a look at Erland Sommarskog’s articles. He has in-depth information on the different ways of doing this kind of thing: