Forum Discussion
Copy data activity not overwriting
Hi alynch ,
As I understand your query, the issue you are facing is that the data is getting overwritten after every iteration of copy activity inside foreach. Please let me know if my understanding is incorrect.
If you would like to write all data to a single file from multiple sources then you will have to copy the files for each iteration to an intermediate folder by appending datetime to the filename ( using parameterized dataset at the sink) and then once all the iterations are completed then have another subsequent copy activity outside of your ForEach activity and point it's source to the intermediate folder and in sink point to your desired file store and then use copyBehavior as MergeFiles in copy activity settings.
You can learn more about it in this document: Copy data from/to a file system - Azure Data Factory & Azure Synapse | Microsoft Learn
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
I think the issue is, that the data is not getting overwriting where it should, but appending instead.