Search code examples
sql-serverssisduplicatesflat-file

SSIS-- Archive Flat File Task Creating Duplicate Files


I have an SSIS package that first looks at a table in the database for flat files that have been ingested. If they have a status of 1, they are ready to be first archived, and then imported into a database table.

I am using a For Each Loop to Archive the Files and then import them into the database and then mark them as processed in the source table.

For some reason, the archive file task is creating duplicate files on SOME files, but not all. And then when this happens, duplicate data gets inserted into the database.

We have a similar package that does the same thing, yet it does not create duplicate files or database entries.

Does anyone know anything off the top of their head? Please let me know if I need to provide more details

Control Flow


Solution

  • A better way of doing what this package does is making sure all the files that you need are in a folder/subfolders and then using for each loop read file after file and save file name in a variable then load data into database and then archive using file system task with additional date and time concatenated to the end of the original file name so there won't be any duplicates.