The postings on this site are my own and do not represent my Employer's positions, advice or strategies.

LifeAsBob - Blog

 

Home

No Ads ever, except search!
Wednesday, April 24, 2024 Login
Public

Email a query or report 10/22/2013 9:51:56 AM

   

There is always a need for reporting, but remembering those requirements is almost always left out, and always there is a desire to use SQL Server Reporting Services (SSRS) or SQL Server Integration Services (SSIS) and sometimes in combination with SQL Agent to get these done.

Sometimes there are environmental or local policies that prevent the use of those technologies, but it's still easy to get done.  Attached here is a simple script for sending the results of a query via Email.  It could easily be enhanced to take the query, subject and to lines as attachment so it could be used generically for different results.  Scheduling can easily be done with windows task scheduler.

This example uses vb script, just rename it to have .VBS extension, but could easily be done in power shell as well.

Email_Query.txt (5.08 KB)


Blog Home