I have the following test stored procedure:
CREATE PROCEDURE dbo.sp_TestSSIS (@a int)
AS
BEGIN
SET NOCOUNT ON
DECLARE @myval int;
SET @myval = (SELECT MAX(TestValue) % 2 FROM Test_SSIS_SP)
RETURN @myval
END
When I run it in SQL Server Management Studio I get the correct results - 0 for even number and 1 for odd.
In SSIS I use the Execute SQL Task with a OLE DB connection, ResultSet none and the following SQLStatement:
exec ? = sp_TestSSIS ?
and I have two parameters:
User::SPResult ReturnValue LONG 0 -1
User::SPDummy Input LONG 1 -1
Everything I read says SPResult should contain either 0 or 1, but I'm getting -1 everytime. I've tried every which way I could think, including using OUTPUT paramters, but to no avail. What am I missing?