我有一个 SSIS 包,它遍历一个表,并且对于表中的每一行,将来自两个不同列的值作为参数传递给存储过程。至少,这是它应该做的。它实际上做的是给我这个错误:
[Execute SQL Task] Error: Executing the query "EXEC sproc_AccessImport @mAccessLocation (SELECT M..." failed with the following error: "Must declare the scalar variable "@mAccessLocation".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
我按照本教程制作了获取信息的部分,并且应该执行存储过程的代码是:
EXEC sproc_AccessImport @mAccessLocation (SELECT MVID FROM tbl_AccessMailDataFiles WHERE FileLocation = @mAccessLocation)
我一直在网上四处寻找,但没有发现任何有用的东西。这是我第一次使用 SSIS,所以我怀疑我只是做错了什么。有谁知道那到底是什么?谢谢。
编辑:我尝试使用以下选项将变量映射为参数:
Variable Name: User::mAccessLocation
Direction: Input
Data Type: VARCHAR
Parameter Name: Path
Parameter Size: 200
并将 SQL 查询更改为:
EXEC sproc_AccessImport @Path (SELECT MVID FROM tbl_AccessMailDataFiles WHERE FileLocation = @Path)
它现在给了我错误:
[Execute SQL Task] Error: Executing the query "EXEC sproc_AccessImport @Path (SELECT MVID FROM tb..." failed with the following error: "Must declare the scalar variable "@Path".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
所以,真的,同样的错误。