Groups | Blog | Home
all groups > sql server dts > march 2006 >

sql server dts : Execute SQL Task using the return value off a SP.


Andre V.
3/7/2006 3:42:36 AM
Hello,

I'm having some troubles using de Execute SQL Task. I have defined the
following stored procedure:

ALTER PROCEDURE dbo.sp_InsertDateImage
AS
BEGIN
SET NOCOUNT ON
Insert into DataImage (Image) values (null)
RETURN @@IDENTITY
END

I want to use the return value off this SP. The following properties are set
in SQL Task:

SQLStatement: EXEC ?=dbo.sp_InsertDateImage
ResultSet: Single Row
ConnectionType: OLE DB
Parameter Mapping: User::ImageKey, returnValue, long, @pKey
Result set: @pKey, User::NewResultName

I get the following error:
[Execute SQL Task] Error: Executing the query "EXEC
?=dbo.sp_InsertDateImage" failed with the following error: "Invalid parameter
number". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not
established correctly.

Does anybody know what the problem is.

Tnx.

Allan Mitchell
3/7/2006 3:09:50 PM
Hello Andre V.,

You are using SSIS?

Have a look here

http://wiki.sqlis.com/default.aspx/SQLISWiki/ExecuteSQLTaskAndParameterOddities.html



Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

[quoted text, click to view]

Andre V.
3/7/2006 10:39:27 PM
Great Allan. This did the trick.

[quoted text, click to view]
AddThis Social Bookmark Button