Blog

How to send a Scheduled HTML report directly from SQL Server

By Gabriel Palma   The situation A customer asked recently for a quick daily report of about-to-expire items, he wanted something simple that could be sent via email to the people already registered in the database. Acquiring the information was very simple (as simple as writing a query). The problem was getting those results inside an email and sending it automatically every day. We came up with a scheduled SQL Server job running daily, getting and shipping the results without passing through .Net code.   The steps Step 1. Write the query to retrieve the raw data.   I used AdventureWorks database for the following example. Here I’ll get a report of work orders with due date ...