Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Sendmail either via SSIS or SQL Agent Expand / Collapse
Posted Monday, April 14, 2008 4:51 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, January 25, 2016 2:42 PM
Points: 37, Visits: 161
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?"
Post #484701
Posted Tuesday, April 15, 2008 7:08 AM


Group: General Forum Members
Last Login: Tuesday, August 10, 2010 5:07 AM
Points: 2,661, Visits: 23,078
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.
Post #484973
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse