October 6, 2008 at 11:36 am
I have an Execute SQL Task that uses an OLE DB connection to SQL Server, and calls a proc that contains two output parameters. In the Execute SQL Task, the SQLStatement looks like this:
EXEC dbo.FirstNamesUpdate ?, ? OUT
The parameter mapping looks like this:
Variable Name Direction Data Type Parameter Name Parameter Size
User::Updates Output LONG 0 -1
User::FirstNames Output Varchar 1 -1
The parameters are defined at the package scope:
User::Updates Int32
User::FirstNames String
The proc looks like this:
CREATE PROCEDURE [dbo].[FirstNamesUpdate]
(
@FirstNameUpdatesOut int = 0 OUT,
@TableNameOut varchar(100) OUT
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @FirstNameUpdates Int
UPDATE dbo.FirstNames
SET FirstName = cd.FirstName
FROM dbo.FirstNames fn, dbo.CustomerDataSource cd
WHERE fn.ssn = cd.ssn
SET @FirstNameUpdates = @@Rowcount
SET @TableNameOut = 'FirstNames'
SET @FirstNameUpdatesOut = @FirstNameUpdates
SELECT @FirstnameUpdatesOut AS FirstNameUpdatesOut, @TableNameOut AS TableNameOut
END
When I run the package, I expect User::Updates = 3 and User::FirstNames = 'FirstNames". User::FirstNames comes out correctly, but User::Updates comes out as 75626496. When I comment out the pieces in the proc that deal with FirstName, the User::Updates variable turns out correct.
Is there something wrong in the proc with the way I'm handling the output parameters, or is there some othe problem?
Thank you for your help!
CSDunn
October 6, 2008 at 2:35 pm
Never mind on this. It turned out to be a problem with the SQL Statement. I should have had it set up as follows:
EXEC dbo.FirstNamesUpdate ? OUTPUT, ? OUTPUT
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply