Friday, March 9, 2012

How to read the return value of a stored procedure?

Stored procedure in SQL Server 2K is as follows..

CREATE PROCEDURE TestDataRead

@.TestString varchar(20) OUTPUT

AS

SET @.TestString = 'Mr.String'

GO

--

SSIS package details.

OLEDB connection manager; Connection works fine.

Execute SQL Task Editor properties are as follows.

ResultSetàNone

SQLStatementà exec TestDataRead

SQLSourceTypeBig SmileirectInput

Parameter Mapping:

VariableName: selected the user variable from the list.

Direction: Output

DataType:varchar

Parameter Name: 0

Parameter Type: 20

When I run I am getting the following error.

SSIS package "TEST SSIS1.dtsx" starting.
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "exec TestDataRead" failed with the following error: "Procedure 'TestDataRead' expects parameter '@.TestString', which was not supplied.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. ...........................................
...................................................................

Please help.

Smith

John Smith001 wrote:

SQLStatementà exec TestDataRead ? OUTPUT

For output parameters also it needs to be passed when calling the stored procedure.

Thanks

|||

Thank you, Karunakarana!

No comments:

Post a Comment