I need to send the results of a CLR stored procedure (I am not able to alter the sproc / clr assembly) as HTML with email. Is there a posibility to capture and format the resultset of the sproc (to email it) without using temp tables or other kind of persisting?
USE msdb
EXEC sp_send_dbmail
@profile_name = 'MailProfile1', --you will need to create this profile in the Database Mail under Management
@recipients = 'test@email.com',
@subject = 'CLR Sproc Resultset',
@body = 'Resultset is attached.',
@execute_query_database = '[DatabaseName]',
@query = 'exec [DatabaseName].[SchemaName].[CLRProcName]'
Try this out, hopefully it should get what you need.