Sendmail either via SSIS or SQL Agent

  • I have a SSIS package that builds a control table that contains a flag in it for records that are either 'X' or 'Y'. I have a conditional split that separates the records. I want to be able to use a sendmail task to email the records for only the 'Y' records when they exist, which is for the most part not all the time. How can I get the sendmail to receive a 'IF records "Y" exist sendmail...IF NOT then END?"

  • Ok, I am going to make some assumptions.

    1) You have a data flow task that is writing your data to two text files (X and Y records)

    2) You want to send the email message when there are Y records and attach the Y file

    With that out of the way, add a global variable (of type INT) to your package.

    In the end of your data flow task - just before the destination component writing the Y file, add a COUNT transformation.

    Set the COUNT transformation to update the variable.

    In the control flow of the package, connect your sendmail task to your data flow task.

    Now, open the connector and set the flow to require "Success" AND @YourVariable!=0

    I hope you followed all of that.

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

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