I have a CSV file with a single column, id, and 3 rows: 10, 20, 30. What I want to do is simply delete the rows from a table in a database where the table's id col contains any of the three values. How do I do this with one DELETE FROM command being sent, not 3?
I can read the file in SSIS within a Data Flow, so far so good. I can store the result in a RecordSet variable/parameter and pass it along to other tasks, I got that far. I know I can't use an OLE DB Command step in the Data Flow because that will execute one SQL statement per row - not a real problem with 3 rows but obviously reality isn't so trivial - so an Execute SQL task is probably going to be involved at some point. Question is, am I really going to have to somehow manually create the string '10', '20', '30' using a C# script, manual FOR loop, or some other contorted concoction, just to run a DELETE FROM?! Is there some simpler solution I'm missing?
For context, this is part of a larger task where I'm trying to create an SSIS package that reads CSV files into tables and deletes from the target tables the ids that are being uploaded (i.e. it overwrites what's already there if needed). I am aware that I can solve this problem in general by creating a job on the server which first truncates a staging table, then runs an SSIS package that simply loads the CSV blindly into the staging table, then a 3rd step which deletes from the target table and selects the staging table into the target - it's not a solution I like but I can accept that it's the way to do things. My question is more to do with trying to learn working with SSIS and less about achieving a result.