Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only send email report if data in it

Status
Not open for further replies.

mossbs

Programmer
Aug 19, 2008
102
GB
Hi guys,

Trying to create a SSIS package to produce then email a report, if the data in the tables is correct then the report should contain no rows and as such i just want to send an email saying 'no rows... (or words to that effect).. but if the report does have data in then i want to send a different email with the report attached.

I know how to use the send email task, and add attachments etc, just unsure how to get the package to do one or another.

any ideas?

cheers guys.

Dan
 
when you go query the data, add a row count to that and set it to a variable. Then add two constraints that happen bassed on an expression (i.e. is row count =0 do this, if greater than 0 do that)


This is really vague, let me know if you want more follow up.
 
hi mike,
cheers for your reply.

Yeah could you offer a little more info on the process of adding rowcount and storig it to variable etc, and the contraints bit.

Did a little bit of searching about and i think i found that constraints in SSIS are written in a similar langauge to C# (i could be well off the mark here but swear i found a web page that said this) if this is the case... c# is most certainly not a strong point of mine.. in that i am a simple ol' sql bod!

so any more info you could provide would be brilliant.

cheers buddy.

Dan
 
just to say - i have figured out how to do all this now.

- Set up a User variable to hold to row count with scope of whole package.
- got the row count working
- in control flow added constraints between data flow task and 2 send mail tasks
- also included row count in the message source using an expression.


amazing what you can do when you put your mind to it!

cheers anyway Mike.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top