Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Execute SQL Task Expand / Collapse
Author
Message
Posted Saturday, February 8, 2014 2:13 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, February 13, 2014 6:01 AM
Points: 17, Visits: 148
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
Post #1539478
Posted Tuesday, February 11, 2014 6:37 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, July 25, 2014 8:29 AM
Points: 368, Visits: 1,232
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?


  Post Attachments 
Package_1.jpg (7 views, 101.22 KB)
Package_2.jpg (8 views, 44.69 KB)
Package_3.jpg (5 views, 87.21 KB)
Package_4.jpg (4 views, 27.09 KB)
Post #1540167
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse