September 25, 2003 at 1:26 pm
I have borrowd a stored procedure off of this site that sends an email using the CDONTS functionality. (I need to avoid using SQL Mail its related MAPI profile because it is causing our services to hang.) The stored procedure sends the email and works great however, I want to include the result set of a stored procedure to be included in the body of the email and the only thing I receive in the email is the literal name of the sql statement or stored procedure that I am trying to execute.
Here is my statement below. sp_mailer is the stored proc that sends the email and takes the variables @From, @To, @cc, @Subject, @body.
DECLARE @SQLString NVARCHAR(4000)
SET @SQLString='sp_MasterEmailList_NCREmailUpdate_Process'
EXECUTE sp_executesql @SQLString
EXECUTE Email_Notification.dbo.sp_mailer 'MSSQLAdmin@netbank.com', 'jminnick@netbank.com; ralarcon@netbank.com', '', 'Email Update Report', @SQLString
Any suggestions or help would be greatly appreciated.
Thanks,
Julie
September 30, 2003 at 6:31 am
Without seeing the proc code, it looks like it sends the contents of the @body parameter as the body of the email and not the results of the query.
xp_sendmail is an extended procedure and without knowing how it works, I guess that when you pass a query it executes it and sends the results as the body.
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply