November 3, 2010 at 1:23 pm
Hi,
How can I use SSIS to send an email is a condition is met?
For example, if I do a count and if the count is greater than 10, then send email.
I tried doing Data Flow Task then in the OLE DB Source I put in my SQL query (select count(*) as TotalCount from TableName where tableid >'0';), so my output will be the value of TotalCount, from there, I added the Conditional Split task, and got stuck. I have my Send Mail task in Control Flow section, but not sure how I would connect the Conditional Split task to the Send Mail Task if the output is greater than 10. Let me know what I'm doing wrong or if there is a different way of doing this.
Thanks,
November 3, 2010 at 1:27 pm
You can't send the mail from the data flow. Just populate the variable and then use an expression in the precedence constraint to evaluate the variable and envoke the send mail task when the variable meets your condition.
November 3, 2010 at 1:44 pm
Use an Execute SQL task in your Control Flow to get the count and assign it to a variable - then use a precedence constraint to direct flow to your e-mail task, based on the contents of the variable.
-- Sorry John - I noticed that I almost quoted you verbatim when I looked back at what I'd written 🙂
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 3, 2010 at 3:46 pm
Phil Parkin (11/3/2010)
-- Sorry John - I noticed that I almost quoted you verbatim when I looked back at what I'd written 🙂
That would be a good compliment to me if you did.
November 4, 2010 at 6:27 am
Thank you guys..
November 8, 2010 at 9:33 am
Is it possible to pass the output value to the Email Task body? If so, how?
November 8, 2010 at 10:33 am
You mean include the Row Count inside the email message....yes. You'll need to use the expression builder to build out the message body property (MessageSource, I think) and include the row count variable. Here's an example of how that type of expression would look:
"This is my variable value: " + (DT_WSTR, 10) @[User::Counter]
November 8, 2010 at 2:25 pm
Got it... thank you!
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply