I have the following:
EXEC msdb.dbo.sp_send_dbmail
@recipients=N'email@addres
s',
@body='None',
@subject ='Subject',
@body_format = 'HTML',
@profile_name = 'Profile',
@query ='set nocount on; exec dataDayStrip 657,4,7; set nocount off;',
@attach_query_result_as_fi
le = 0,
@query_result_header = 1,
@query_result_width = 1000,
@exclude_query_output = 1,
@query_result_separator = ';'
This all works fine, except the email I receive includes the output of "dataDayStrip" procedure as unformatted and unreadable gobblygook. I'd like to format it into HTML (or another format possibly). How can I either do this automatically, or get a reference to the query result as a string to parse it manually or through another stored procedure? Or call the procedure and save the result set into a string and then parse that variable and then pass it along to the @body of the email.
The procedure that is being called uses dynamic sql and returns a simple resultset.
Start Free Trial