dbTalk Databases Forums  

Execute SQL Task using the return value off a SP.

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Execute SQL Task using the return value off a SP. in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andre V.
 
Posts: n/a

Default Execute SQL Task using the return value off a SP. - 03-07-2006 , 05:42 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.



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Execute SQL Task using the return value off a SP. - 03-07-2006 , 05:09 PM






Hello Andre V.,

You are using SSIS?

Have a look here

http://wiki.sqlis.com/default.aspx/S...rOddities.html



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

Quote:
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.




Reply With Quote
  #3  
Old   
Andre V.
 
Posts: n/a

Default Re: Execute SQL Task using the return value off a SP. - 03-08-2006 , 12:39 AM



Great Allan. This did the trick.

"Allan Mitchell" wrote:

Quote:
Hello Andre V.,

You are using SSIS?

Have a look here

http://wiki.sqlis.com/default.aspx/S...rOddities.html



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

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.





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.