Hi,
I am running Stored Procedure using "EXEC msdb.dbo.sp_send_dbmail" and calling stored procedure under query parammeter and should email the attachment but it runs and says "Command(s) completed successfully." but no attachment.
When i tried to run only stored procedure then it runs and shows result sets.
I can run other sql query using "EXEC msdb.dbo.sp_send_dbmail" but this one giving me the problem.
Following si my code:
Code:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'profile1',
@recipients = 'ptest@domain.com',
@body = 'AVG_MAX counts',
@query = 'EXEC Report_AVG_MAX_counts',
@query_result_width = '250',
--@query_result_width = '1',
@subject = 'AVG_MAX counts',
@query_attachment_filename = 'AVG_MAX_counts_File_txt.txt',
@query_result_separator = ',',
@body_format = 'HTML',
@exclude_query_output = '1',
@attach_query_result_as_file = 1;
Your help really appreciated.
Thanks for your help!