I want to select from a table where a field is in a given csv string passed to a stored proc.
What is the fastest way to do this? Should I insert the values into a temporary table and join to that? Or is there a way to do it with one statement?
Thanks
NEW ANSWER –
Well you have to do something like this as given below.
I am assuming your csv string would be as given in variable @str below. Else you need to make sure that your string (or arraystring) should have this format with single quotes for every element –
OLD ANSWER –
I assume that you will pass the csv file path to stored proc and read the lines in csv in that stored proc. So basically you can store all those csv field values in a temp table and write query using IN –