June 11, 2009 at 11:56 pm
Hi,
Below is the query i used in SQL2005 to send a mail with an txt attachment which had the result of a query.
EXEC @statusMail = [MSDB].dbo.sp_send_dbmail @profile_name = 'dbmail',
@recipients = @ToemailID
,@copy_recipients = @CCEmailID
,@blind_copy_recipients = @BCCEmailID
,@query = @sqlquery
,@subject='XYZ'
,@body = XYZ'
,@query_attachment_filename ='XYZ.txt'
,@attach_query_result_as_file = 1
,@query_result_width = 250
Though it worked out fine, now, i need to send 2 files as attachments in the same mail both the attachements are query results. How can this be done in SQL2008? If i have the files as images in a DB table, would it make it any easier?
Any help??!!!
Thanks in advance 🙂
June 13, 2009 at 9:03 am
I don't think this is possible with sp_send_mail. What about CLR?
June 13, 2009 at 10:44 am
You could try putting the two queries into a procedure, and then specifying to execute that procedure as the query. That may do the trick.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2009 at 11:16 pm
I dont think using an SP would solve the issue as i need to send 2 attachments in the email
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply