user2331670
user2331670

Reputation: 335

Execute SQL Server stored procedure through SSIS

I have this stored procedure:

CREATE PROCEDURE [dbo].[sp_Carrier_Scan_Compliance]
     (@RETAILERID  INT OUTPUT,
      @SYSTEM_ID  VARCHAR(10) OUTPUT)
AS
BEGIN
    SET @RETAILERID = 2
    SET @SYSTEM_ID = 'DMASOS'
    ...
END

I have created a SSIS package using a Execute SQL Task in the control flow.

These are my Execute SQL Task editor settings:

enter image description here

This are my Variable settings:

enter image description here

These are my Parameter Mapping settings:

enter image description here

When I run the SSIS package, I get an error:

Error: 0xC002F210 at Execute SQL Stored Procedure (to copy data from 'BI-Datatrunk' source table) Task, Execute SQL Task: Executing the query "exec = [sp_Carrier_Scan_Compliance] ? OUTPUT, ? O..." failed with the following error: "Incorrect syntax near '='.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Task failed: Execute SQL Stored Procedure (to copy data from 'BI-Datatrunk' source table) Task
Warning: 0x80019002 at Carrier_Scan_Compliance_SP: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

I am not sure what I am missing.

Please help me.

Thanks

Upvotes: 1

Views: 5339

Answers (1)

Mazhar
Mazhar

Reputation: 3837

The key part of the last error is

The EXECUTE permission was denied on the object 'sp_Carrier_Scan_Compliance', database 'DATAK', schema 'dbo'."

You need to assign EXECUTE permissions to the SQL user executing the Proc

USE DATAK
GO
GRANT EXECUTE ON sp_Carrier_Scan_Compliance TO <sql user>
GO 

Upvotes: 2

Related Questions