Unanswered: E-mail query results with Database Mail
Is it possible to e-mail multiple lines from a table by using database mail.
I have a stored proc that inserts data into a table variable and if there
is information in the table execute the msdb.dbo.sp_send_dbmail stored proc.
I am struggling to pass multiple lines to the body of the e-mail.
It is definitely possible to do this. The example below will attach the results as a text file. If you set the @attach_query_result_as_file parameter to 0 the result will be appended to the body of the email.