Executing Stored Procedure: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
-
Tuesday, February 12, 2013 8:17 PM
Hi All,
I have the following stored procedure
CREATE PROCEDURE [dbo].[GetEmailAddress]
@SrcName varchar(50)
AS
BEGIN
DECLARE @combinedString varchar(255)
DECLARE @ToAddress varchar(255)
SELECT @combinedString = COALESCE(@combinedString + ';','') + ToAddress ,@Toaddress =(select distinct FromAddress from dbo.acn_GetEmailDetails)
FROM dbo.acn_GetEmailDetails
where MailMessage='Missing File' and Flag=1 and SourceName=@SrcNameSELECT @combinedString,@ToAddress
END
I am using a SQL Task for executing this procedure,
EXECUTE [dbo].[GetEmailAddress] ?
I am getting the below error message,Not sure what is wrong,i checked the parameter mapping and result set ,everything look okay..
[Execute SQL Task] Error: Executing the query "
" 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.Appreciate any help..
Thanks
All Replies
-
Tuesday, February 12, 2013 8:27 PM
Hi,
Try commenting out the second SELECT, the one that just says SELECT @combinedString, @ToAddress
Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu
-
Tuesday, February 12, 2013 8:28 PM
Since you declared @SrcName as a parameter, make sure you pass an argument for that parameter when you execute the stored procedure:
EXEC [dbo].[GetEmailAddress] @SrcName= 'Varchar Value';
Also, if you want to return something from the stored procedure, you'd want to add a RETURN to your SELECT statement at the end:
RETURN (SELECT @combinedString,@ToAddress)
http://msdn.microsoft.com/en-us/library/ms189915.aspx
http://msdn.microsoft.com/en-us/library/ms378371.aspx
- Edited by jonfaulkenberry Tuesday, February 12, 2013 8:33 PM
- Marked As Answer by Eileen ZhaoMicrosoft Contingent Staff, Moderator Monday, February 25, 2013 2:30 AM

