I am tasked with the following:
The customer wants to read a number (possibly thousands) of values from a csv file. I have to use these values in an SQL select statement like this:
SELECT * FROM myTable WHERE myTable.Value IN (cvsValue1, csvValue 2, ..., csvValueN)
The question is: Will this work for an arbitrary number of csv values, and will it perform well for large number of values?
I will need to save the SQL as a string internally in my C# application for later use. (if that makes a difference for alternative solutions)
You really don’t want to do that. It would be better to dump those values into an indexed table and use
INas a subquery (which typically implements aSEMI JOIN(more info) vs the array of strings (which is typically implement as a series ofORoperations.from BOL: