I am writing a stored procedure which collects all changes that were happend in a table for a given date and would like to send recordset to an administrator via email from SQL Batch Job.
Now untill now, I couldn't figure out is how to send recordset in an email body. Is it possible to construct email body based on the recordset obtained from some tsql logic.
Any help is appriciated
Thanks
TheITGuy
Look into the sp_send_dbmail procedure, which allows you to execute a query and send the results in the e-mail body or as a file attachment.
The firm I work for requires the name/value pair to be on separate lines rather than in a table. While my solution could use some tuning, after much work, I came up with a solution with css formatting. I can't figure out why, however, the width of the NAME column isn't 100px, as I have requested.
The special characters are < alt >+0182, < alt >+0183 and < alt >+0185, respectively.
I will continue to strive for a more elegant solution without so many replace functions but the firm is more concerned with a 'now' solution than an elegant one. Feedback/improvements would be appreciated.
The email arrives (in Outlook) formatted as such, which is our firm's preference:
Tennis Rankings Info
Rank: 1
Player Name: Rafael Nadal
Points: 12390
Country: Spain
Rank: 2
Player Name: Roger Federer
Points: 7965
Country: Switzerland
Rank: 3
Player Name: Novak Djokovic
Points: 7880
Country: Serbia
Here is my solution:
This might provide you some impetus: