Asked • 05/23/19

tsql to export and attach SSRS report to email?

I don't think there's an easy way to do this, but here goes. We have an `SSRS` report that can be invoked with `http://MyServer/ReportServer/Pages/ReportViewer.aspx?%2fSales%2fSalesReport` We also use database mail to send our emails, so the code looks like this: EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Joe Smith', @recipients = '[email protected]', @subject = 'Daily Sales', @body = 'Some HTML', @body_format = 'HTML' ; Using only tsql, can I somehow include the Excel as an attachment to the email sent? The Excel can be viewed locally using `http://MyServer/ReportServer?%2fSaless%2fSalesReport&rs:Command=Excel`, but I'm not sure how I can include it as an attachment. Thanks.

1 Expert Answer

By:

Matt S. answered • 05/23/19

Tutor
5.0 (65)

Data Analyst Specializing in MS SQL Server, SSIS, SSRS, Visual Basic

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.