Help need to use For Each Enumerator

  • Hi,

    I need to pick data from CSV files one by one from a specific folder and put the data retrieved (in each CSV file) to a table in DB. At the end of processing, I need to delete all the CSV files from that specific folder.

    I just heard about the For-each Enumerator in SSIS. How can I utilize For-Each enumerator for my requirement? Will there be any option in For-each container to delete CSV files? or should I have to write separate task to do that? If need to write separate task, what task would help me and how to use that?

    Thanks in advance,

    Suresh

    Regards,
    Suresh Arumugam

  • Suresh Kumar (2/9/2009)


    Hi,

    I need to pick data from CSV files one by one from a specific folder and put the data retrieved (in each CSV file) to a table in DB. At the end of processing, I need to delete all the CSV files from that specific folder.

    I just heard about the For-each Enumerator in SSIS. How can I utilize For-Each enumerator for my requirement? Will there be any option in For-each container to delete CSV files? or should I have to write separate task to do that? If need to write separate task, what task would help me and how to use that?

    Thanks in advance,

    Suresh

    Suresh,

    For-Each enumerator is a container type, which contains other control flow tasks. After you setup your for-each enumerator to iterate over your CSV files, you have to setup a data flow task, which loads the data from the current for-each iteration. You have to connect the data flow task as a next step to "File System Task", with operation "Delete file" to remove the already processed file. Now all this will work if all your CSV files have the same layout and number of columns. If they are different, it will be more complicated.

    I would recommend you find good books about SSIS. These are good choices:

    http://www.amazon.com/Microsoft-Server-2005-Integration-Services/dp/0672327813/ref=pd_bbs_sr_8?ie=UTF8&s=books&qid=1233338523&sr=8-8

    http://www.amazon.com/Expert-Server-Integration-Services-Programmer/dp/0470134119/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1233338523&sr=8-1

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • Thanks a lot CozyRoc. I will look into the links that you prodived.

    Also, I have tried using the file system Task to delete files. It works fine.

    Thanks,

    Suresh

    Regards,
    Suresh Arumugam

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply