SSIS flow ADO.net source task with parameter

人盡茶涼 提交于 2019-12-01 23:34:52

Have you tried:

SELECT PARTICIP.*
FROM PARTICIP
WHERE GPMTADDT > DATEADD(dd, -1, GETDATE())

You haven't mentioned what your data source actually is, but there appear to be several errors in the SQL syntax you've tried. e.g. the first query should have single quotes around the date, the last one should put the argument to MAX() in parentheses etc.

But to try to answer your basic question, ADO.NET sources do not support parameters, unlike OLE DB ones that do. Some possible solutions are:

  1. Don't use a parameter if you can generate the value in the source itself; this is what you are trying to do in your last example and what Jeff has suggested
  2. Use an SSIS expression to set the SqlCommand property of the connection object, together with an SSIS variable (as described here)
  3. As an alternative to #2, use a Script task to build the complete SELECT query, assign it to an SSIS variable, and then use that variable as the SqlCommand value

Personally I would say that option 1 is the easiest but of course not always possible, if the variable isn't accessible from within the source system. 2 and 3 are variations on the same solution, but I prefer 3 because I find writing a script easier than working with expressions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!