SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Sendmail either via SSIS or SQL Agent


Sendmail either via SSIS or SQL Agent

Author
Message
kimo_rd7
kimo_rd7
Valued Member
Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)

Group: General Forum Members
Points: 55 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?"
Michael Earl-395764
Michael Earl-395764
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13301 Visits: 23078
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search