I have created a stored procedure. While trying to execute it through SSIS I'm running into problems.
The definition of my stored procedure looks something like this:
CREATE PROCEDURE dbo.[procedurename]
@startDate DATETIME,
@endDate DATETIME,
@cumulativeAverage DECIMAL(5,2) OUTPUT
AS
/*stored procedure body that return a table with 3 columns and assigns value to output variable*/
RETURN
GO
I'm capable of running this is SSMS and it works fine. But when I try to run it in Execute SQL task in SSIS, it doesn't work and I get this error:
Error: 0xC002F210 at EXEC at Execute SQL task name. Execute SQL task: Executing the query EXEC DBO.procedurename ?, ?, ?..." failed with the following error: Multiple OLE DB operations generated error. Check each OLE DB status value...
My SSIS scripts are as below.
Result set : Full result set.
SQL source type : direct input.
SQL statement : EXEC dbo.[procedurename] ?, ?, ? OUTPUT
Parameter mappings : variable name- User::startDate, Direction- Input, Data Type- Date, Parameter
Name- 0, Parameter size- -1
variable name- User::endDate, Direction- Input, Data Type- Date, Parameter Name-
1, Parameter size- -1
variable name- User::cumulativeAverage, Direction- output, Data Type- numeric,
Parameter Name- 2, Parameter size- -1
Result set : Result name- 0, Variable name- User::ResultSet
Variables : Variable name- CumulativeAverage, Scope- package, Datatype- Decimal, Value- 0
Variable name- EndDate, scope- Package, Datetype- DateTime, Value- 5/03/2021
Variable name- StartDate, scope- Package, Datetype- DateTime, Value- 12/28/2020
Variable name- ResultSet, scope- Package, DateType- Object, Value- System.Object
As pointed out by @billinkc, I was able to isolate the problem for me. The issue was being caused by the
@cumulativeAverage DECIMAL(5,2) OUTPUT
parameter. It was because i was unable to set the precision of the variable in SSIS. Although, i'm still unable to find a way to set the precision. I changed the SP to returnFLOAT
value for theOUTPUT
parameter, configured the SSIS variables to exceptFLOAT
data type and now it works fine.