Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I send the result set from a query as an attachment in an email using SSIS?

Tags:

People also ask

How do I send a query result as an email attachment?

To email the results of a query, use the @query argument. To attach those results as an attachment, use the @attach_query_result_as_file argument. This is accepts a bit value, with the default being 0 (for no attachment). To send the results in an attachment, simply provide a 1 for this argument.

How do I email a query result?

SQL Server provides an easy way to email the results of a query to yourself (or to someone else). To send email with T-SQL, you need to use the sp_send_dbmail stored procedure in the msdb database. This procedure accepts many arguments, one of which is the @query argument.


I have a result set from an Execute SQL Task query saved on a System.Object variable and i would like to send this results using a Send Mail Task using the following expression on the MessageSource.

"Please find attached data summary\n\n" + SUBSTRING( @[User::myVariable] ,1,3990)
+ "\n\n"