I have a few Sql Scripts that I would like to run every day on my Sql Server(s). How can I query multiple times and have the output similar to the following:
Health check for <server> Query Title 1: <query results 1> Query Title 2: <query results 2>
I am checking things like last good back up, uptime etc so they are not related to each other. I am planning to use sp_send_db_mail inside of a Sql Job. Is this the best way of accomplishing this task?
Ideally, I would only like one email.
After batteling for ages!!! The solution I have found so far is to put it into a sproc and then execute the sproc like so:
EXEC msdb.dbo.sp_send_dbmail @recipients=N'<email>', @body= @body, @subject = @subjectt, @profile_name = @ProfileName, @query ='exec test..sp_checks'
Is this ok for multiple select statements?