sql – 无法将变量值传递给ssis中的存储过程

执行SSIS包时,会出现以下错误:

[OLE DB Source [83]] Error: The SQL command requires a parameter named
“@Sales_person”, which is not found in the parameter mapping.

[SSIS.Pipeline] Error: OLE DB Source failed the pre-execute phase and
returned error code 0xC0207014.

下面是我的OLE DB Source编辑器的屏幕截图
《sql – 无法将变量值传递给ssis中的存储过程》

《sql – 无法将变量值传递给ssis中的存储过程》

《sql – 无法将变量值传递给ssis中的存储过程》

我确实在Set Query参数中看到Param方向选项卡,该怎么用?在我的情况下,我将使用输入或输出或InputOutput

最佳答案 搜索后我没有找到适合这个问题的解决方案.很多建议就像在执行命令之前添加SET NOCOUNT ON一样.下面是一些相关链接:

> http://geekswithblogs.net/stun/archive/2009/03/05/mapping-stored-procedure-parameters-in-ssis-ole-db-source-editor.aspx
> http://www.sqlservercentral.com/articles/Data+Flow+Task+(SSIS)/117370/
> http://www.ssistalk.com/2007/10/10/ssis-stored-procedures-and-the-ole-db-source/

你可以做一个解决方法

声明一个SSIS变量(假设@ [User :: Query])

设置@ [User :: Query]属性EvaluateAsExpression = True并使用以下表达式

"EXEC [dbo].[GetDales_Person_data] " + @[User::Sales]

如果@ [User :: Sales]是一个字符串,请使用以下内容

"EXEC [dbo].[GetDales_Person_data] '" + @[User::Sales] + "'"

然后在OLEDB源中使用SQL命令从变量中选择@ [User :: Query]

点赞