Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

sp_send_dbmail Wrapper for HTML

$
0
0
Someone, somewhere, must have done this. Please share if you have.As many will know, executing sp_send_dbmail @query='query', [other args here]sends an e-mail with the results of the query embedded in the body of the e-mail.The problem is that the results are displayed in a proportional font and they do not line up nicely in columns.The MS-suggested workaround is to format the results of the query in HTML (see [url=https://msdn.microsoft.com/en-us/library/ms190307.aspx]Example C[/url] here).This requires manual coding for every result set you wish to send.Wouldn't it be nice if you could callusp_send_dbmail @query='query', @EmailFormat='HTMLTable' (or whatever)which would then run some fancy SQL to call sp_send_dbmail & send the e-mail in HTML tabular format?

Viewing all articles
Browse latest Browse all 3145

Trending Articles