本文转自:http://geekswithblogs.net/stun/archive/2009/03/05/mapping-stored-procedure-parameters-in-ssis-ole-db-source-editor.aspx

I was working on a SSIS Data Flow Task by passing Package Variables into a Stored Procedure. I will be using [AdventureWorks] sample database included with the SQL Server installation. Below is the screenshot of bits and pieces of my SSIS Package configuration.

As you can see, I have defined 2 Package Variables and using the [AdventureWorks] database connection and a Flat File Connection Manager to dump out the [uspGetWhereUsedProductID] Stored Procedure's output.

This is the SQL command text I am using in the OLE DB Source Editor dialog window.

EXEC [dbo].[uspGetWhereUsedProductID] ?, ?

Here is the screenshot of the Parameter Mapping.

As you can see, Parameter0 and Parameter1 were used to match the Stored Procedure's parameters' ordinal positions. When I execute the Data Flow Task, I get the following error message.

The SQL command requires a parameter named "@ParameterName", which is not found in the parameter mapping. component "OLE DB Source" (1) failed the pre-execute phase and returned error code 0xC0207014.

It was obvious that I am not mapping the Stored Procedure's parameters with the SSIS Package Variables correctly. I looked up OLE DB Source in the MSDN Library Documentation. The Specifying Parameters by Using Names section used AdventureWorks database's [uspGetWhereUsedProductID] stored procedure as an example and passing in @StartProductID and @CheckDate parameters.

The following SQL statement runs the uspGetWhereUsedProductID stored procedure, available in the AdventureWorks database.
EXEC uspGetWhereUsedProductID ?, ?
The stored procedure expects the variables, @StartProductID and @CheckDate, to provide parameter values. The order in which the parameters appear in the Mappings list is irrelevant. The only requirement is that the parameter names match the variable names in the stored procedure, including the @ sign.

That is *exactly* what I am doing and I am getting the error. So I am pretty sure the MSDN Documentation is not clear enough (or maybe even incorrect).
Additionally, I looked up How to: Map Query Parameters to Variables in a Data Flow Component listed under the Configuring the OLE DB Source section. Again, it doesn't give any more information. By this point, I was getting pretty frustrated.
I browsed the MSDN Forums and discovered that many other developers are having the SAME problem. I carefully re-read the OLE DB Source documentation in case I missed something and finally noticed this line.

The only requirement is that the parameter names match the variable names in the stored procedure, including the @ sign.

I added/replaced the following with the actual Stored Procedure's Parameter names.

  • The Question Marks (?) in the SQL command text
  • Parameter0 and Parameter1 in the Set Query Parameters dialog window

I was very happy to discover that my SSIS Package runs successfully after the changes.
I really wished the MSDN Documentation team gave more details on OLE DB Source Parameter Mapping. It would have saved me the headache of looking for a solution and feeling like pulling out my hair.
Happy Programming, Soe

[转]Mapping Stored Procedure Parameters in SSIS OLE DB Source Editor的更多相关文章

  1. [转]SSIS OLE DB Source中执行带参数的存储过程

    本文转自:http://www.cnblogs.com/michaelxu/archive/2009/10/21/1587450.html 问题描述:执行一个存储过程得到一个多条记录的结果集,然后循环 ...

  2. [转]SSIS中OLE DB Source中如何执行Store Procedure 以得到源数据

    本文转自:http://www.cnblogs.com/michaelxu/archive/2009/10/16/1584284.html 有很多人喜欢在OLE DB Source中执行Store P ...

  3. 微软BI 之SSIS 系列 - 通过 OLE DB 连接访问 Excel 2013 以及对不同 Sheet 页的数据处理

    文章更新历史 2014年9月7日 - 加入了部分更新内容,在文章最后提到了关于不同 Office Excel 版本间的连接问题. 开篇介绍 这篇文章主要总结在 SSIS 中访问和处理 Excel 数据 ...

  4. [转]ssis cannot retrieve the column code page info from the ole db provider

    本文转自:http://social.msdn.microsoft.com/Forums/sqlserver/en-US/dc1a61f2-1ab8-4ed3-b85c-db6481800b50/er ...

  5. [转]SSIS: Execute Package via Stored Procedure

    本文转自:http://sqlblog.de/blog/2009/09/ssis-execute-package-via-stored-procedure/ There are two options ...

  6. EF 接收OUTPUT参数的方法 How to Retrieve Stored Procedure Output Parameters in Entity Framework

    原文地址:http://blogs.microsoft.co.il/gilf/2010/05/09/how-to-retrieve-stored-procedure-output-parameters ...

  7. Entity Framework 6.0 Tutorials(9):Stored Procedure Mapping

    Code First - Insert, Update, Delete Stored Procedure Mapping: Entity Framework 6 Code-First provides ...

  8. [转]Dynamic SQL & Stored Procedure Usage in T-SQL

    转自:http://www.sqlusa.com/bestpractices/training/scripts/dynamicsql/ Dynamic SQL & Stored Procedu ...

  9. Retrieving Out Params From a Stored Procedure With Python

    http://www.rodneyoliver.com/blog/2013/08/08/retrieving-out-params-from-a-stored-procedure-with-pytho ...

随机推荐

  1. 设置Eclipse/MyEclipse中编辑界面点击任何文件后Package Explorer导航自动定位该文件

    原文:http://www.myexception.cn/eclipse/425836.html 设置步骤: 导航Package Explorer的右上角有一个黄色双向箭头图标,鼠标移动到上面提示“L ...

  2. linux下文件查询命令(cat,more,less,head,tail)

    众所周知Linux中命令cat.more.less均可用来查看文件内容,主要区别有:cat是一次性显示整个文件的内容,还可以将多个文件连接起来显示,它常与重定向符号配合使用,适用于文件内容少的情况:m ...

  3. classpath中怎样一次性加入整个目录的jar文件

    linux可以通过shell来处理 1 2 3 for jar in $HOME/lib/*.jar; do     CLASSPATH=$CLASSPATH:$jar done          

  4. 如何设置WordPress文章特色图像(Featured Image)

    WordPress的特色图像(Featured Image)是一个很方便的功能,过去为了给每篇文章设置一个缩略图,我们需要用脚本去匹配文章中的第一张或者最后一张图片,或者通过附件方式获取图片,有了特色 ...

  5. jquery实现页面加载时删除特定class 的div内前三个字符

    jQuery(document).ready(function(){        jQuery("div.groupheader").each(function(){ $(thi ...

  6. NOI2014 起床困难综合症 day1t1

    感觉NOI题在向简单方向发展,或者说明年会难到暴呢? 直接模拟啊,枚举每个二进制数位,看经过变换之后是否为1及为1的条件即可.\( O(nlogm)\). 然后...跪了一个点,第五个死活比标准大一. ...

  7. 【面试题】2018年最全Java面试通关秘籍汇总集!

    [面试题]2018年最全Java面试通关秘籍汇总集!(转载于互联网)   前几天在交流群里有些小伙伴问面试相关的试题,当时给出了一些问题,苦于打字太累就没写下去了,但觉得这是一个很不负责任的表现,于是 ...

  8. 【我要学python】面对对象编程之继承和多态

    class animal(object): def run(): print('animal is running...') class dog(animal): def run(self): pri ...

  9. logstash日志写到es,按照时间来进行切割,生成索引配置

    配置如下: es创建索引使用: logstash-chat-proxy-nginx-access-* logstash-chat-proxy-nginx-error-*

  10. 【java】线程安全的整型类AtomicInteger

    一.遇见AtomicInteger 在看项目代码的时候看到这个类,发现其功能很简单,就是一个整型变量的类型,出于好奇看了其类定义. 该类位于java.util.concurrent.atomic下,在 ...