1
votes

I am getting issue sending email from "Execute SQL Task"

failed with the following error:

"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Here is SQL Statement-

USE msdb 
GO
EXEC
sp_send_dbmail 
 @profile_name='DBAAdminSF',        
 @recipients='[email protected]',
 @subject='Data uploaded',
 @body=?

Parameter Mapping:
Variable Name User::Email_DB
Parameter Name =@body

It works fine when I include text for @body parameter directly in the query instead of using Parameter Mapping. Help appreciated.

1

1 Answers

0
votes

Have you tried overriding the script with Expressions instead of parameter mapping?

Sample Expression override i used for a recent project:

"Exec msdb.dbo.sp_send_dbmail 
    @profile_name='Email Profile', 
    @recipients='email_addy', 
    @copy_recipients='email_addy', 
    @subject=N'Subject Text" + @[User::FileMonth] + "', 
    @body=N'Body Text" + @[User::FileMonth] + "' , 
    @file_attachments=N'" + @[User::FilePath] + "' "