SQLTeam.com | Weblogs | Forums

EMAIL results from sql statement to recipients

I have a sql statement exampl

SELECT company, count(distinct employees) from mytable
group by company
order by company

In a SSIS package I would like to send a email out to recipients with the result from that query
I know i would have to create a variable then call that variable from my send email task.
How would i incorporate the above sql into an expression to create my variable. [SQLFetchData]

Write your result set to a file, then use a Script Task to capture your email list into an object variable, then iterate your record set to send each email with the file as an attachment in a For Each Loop Task.