简体   繁体   English

通过SSIS执行SQL Server存储过程

[英]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. 我已经在控制流中使用Execute SQL Task创建了一个SSIS包。

These are my Execute SQL Task editor settings: 这些是我的“ 执行SQL任务”编辑器设置:

在此处输入图片说明

This are my Variable settings: 这是我的变量设置:

在此处输入图片说明

These are my Parameter Mapping settings: 这些是我的参数映射设置:

在此处输入图片说明

When I run the SSIS package, I get an error: 运行SSIS程序包时,出现错误:

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 '='.". 错误:执行SQL存储过程中的0xC002F210(要复制“ BI-Datatrunk”源表中的数据)任务,执行SQL任务:执行查询“ exec = [sp_Carrier_Scan_Compliance]?OUTPUT ,? O ...”失败,并出现以下错误:“'='附近的语法不正确。”。 Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. 可能的失败原因:查询问题,“ ResultSet”属性未正确设置,参数未正确设置或连接未正确建立。

Task failed: Execute SQL Stored Procedure (to copy data from 'BI-Datatrunk' source table) Task 任务失败:执行SQL存储过程(从“ BI-Datatrunk”源表复制数据)
Warning: 0x80019002 at Carrier_Scan_Compliance_SP: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. 警告:在Carrier_Scan_Compliance_SP处为0x80019002:SSIS警告代码DTS_W_MAXIMUMERRORCOUNTREACHED。 The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); 执行方法成功,但是引发的错误数(1)达到允许的最大值(1); resulting in failure. 导致失败。 This occurs when the number of errors reaches the number specified in MaximumErrorCount. 错误数量达到MaximumErrorCount中指定的数量时,会发生这种情况。 Change the MaximumErrorCount or fix the errors. 更改MaximumErrorCount或修复错误。

I am not sure what I am missing. 我不确定我缺少什么。

Please help me. 请帮我。

Thanks 谢谢

The key part of the last error is 最后一个错误的关键部分是

The EXECUTE permission was denied on the object 'sp_Carrier_Scan_Compliance', database 'DATAK', schema 'dbo'." 对对象'sp_Carrier_Scan_Compliance',数据库'DATAK',模式'dbo'的EXECUTE权限被拒绝。”

You need to assign EXECUTE permissions to the SQL user executing the Proc 您需要为执行Proc的SQL用户分配EXECUTE权限

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 执行 SQL 服务器存储过程 - Execute SQL Server Stored Procedure SSIS在SQL Server中异步执行存储过程 - SSIS to execute stored procedures asynchronously in SQL Server 如何从 SQL Server 存储过程执行 SSIS 包并传递参数 - How to execute SSIS package from SQL Server stored procedure and pass arguments 使用 T-SQL 查询和 SSIS 中的存储过程执行 SQL 任务 - Execute SQL task with T-SQL query and with stored procedure in SSIS SSIS 2017“执行 SQL 任务”失败找不到存储过程 - SSIS 2017 "Execute SQL Task" fails Could not find stored procedure 当我通过应用程序执行存储过程时,SQL Server抛出超时,但是当我在Management Studio中执行存储过程时,SQL Server没有抛出超时 - SQL Server throws timeout when I execute a stored procedure through an application, but not when I execute it in the Management Studio 在SQL Server中的另一个存储过程中执行存储过程 - Execute a stored procedure in another stored procedure in SQL server 在SQL Server中执行存储过程的权限问题 - Execute permission issue in sql server for stored procedure 在SQL Server 2016中没有看到“执行存储过程” - Not seeing “Execute stored Procedure” in SQL Server 2016 无法执行SQL Server存储过程 - Can not execute SQL Server stored procedure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM