SSIS count of files processed

  • I have a package that archives old access database files and then send a mail when it completes. I would like to include the number of files processed in the mail message.

    i.e. the message should read

    "Archiving completed, 10 files archived"

    please give direction on how to do this.

  • use foreach loop container, map the folder and inside the container place a script task and write a code for count.

    ForEachLoop |

    -------------------------------------------------

    |

    | --------------

    | |Script Task |

    | ---------------

    |

    |

    |

    ---------------------------------------------------

    define this variable @ package level

    User::CountPublic Sub Main()

    Dts.Variables("User::Count").Value = Dts.Variables("User::Count").Value + 1

    MsgBox(Dts.Variables("User::Count").Value.ToString())

    Dts.TaskResult = ScriptResults.Success

    End Sub

    the output of the foreach loop you will get the count of the files. after that you can append the value and send a mail.

  • Hi Thanks for the feedback,

    I have two execute process task that I need to get count from. the first one does compact and repair, the second one does archiving. I would like to get a count from both of them.

    4 files compacted.

    4 files archived.

    do I out a script task after each one? isn't the data in the variable going to be overwritten as the container loops

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

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