SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Execute SQL Task


Execute SQL Task

Author
Message
rajeshpalo
rajeshpalo
SSC-Enthusiastic
SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)

Group: General Forum Members
Points: 119 Visits: 151
Hi All ,

I am getting error in Sql execute task with below error


[Execute SQL Task] Error: Executing the query "DECLARE @returnvalue int

EXEC @returnvalue =..." failed with the following error: "The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


i am try to execute SP with parameter as nvarchar(max) data type.

In parameter mapping i used as parameter size=2097152

below is the query i am trying to execute

Declare @returnvalue int

EXEC @returnvalue =sp_xyz ?

select 'returnvalue' = @returnvalue



Please help me out....
Thanks in Advance...

Cheer's
Rajesh
higgim
higgim
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1490 Visits: 2631
This may point you in the right direction:

First the stored procedure I created for testing this which accepts @MyParameter as nvarchar(max) type.

IF OBJECT_ID('MH_TEST') IS NOT NULL 
DROP PROCEDURE dbo.MH_TEST

GO

CREATE PROCEDURE MH_TEST
@MyParameter NVARCHAR(MAX)
AS
BEGIN
DECLARE @SomeValue BIGINT = 12345
SELECT @SomeValue AS ThisWasReturned
RETURN
END

GO



The procedure runs and the final part simply selects @SomeValue

Now for the package

Set the ExecuteSqlTask to return a single value result set. (Package_3.jpg)

Set up the ExecuteSqlTask the execute the stored procedure but use an expression to build the command to take into account the variable within the SSIS package you want to pass to the stored procedure (Package_1.jpg)

Set the result set (Package_2.jpg)

Run the package and you should see a message pop up showing what was returned from the SP (Package_4.jpg)

Any help?
Attachments
Package_1.jpg (17 views, 101.00 KB)
Package_2.jpg (18 views, 44.00 KB)
Package_3.jpg (11 views, 87.00 KB)
Package_4.jpg (17 views, 27.00 KB)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search