创建应用程序修改 SSIS 变量并启动 SSIS 包的最佳方法
我的 DBA 有几个 SSIS 包,他希望能够为最终用户提供一种在包中输入变量值的方法。创建一个接受用户输入并将数据传递到 SSIS 包变量的应用程序的最佳解决方案是什么?
我查看了 http:// /blogs.msdn.com/b/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx ,我什至已经非常接近一些此处的信息 - http://msdn .microsoft.com/en-us/library/ms403355(v=sql.100).aspx#Y1913 。
我可以使用此代码在本地完成这项工作
Dim packageName As String
Dim myPackage As Package
Dim integrationServices As New Application
If integrationServices.ExistsOnSqlServer(packageName, ".", String.Empty, String.Empty) Then
myPackage = integrationServices.LoadFromSqlServer( _
packageName, "local", String.Empty, String.Empty, Nothing)
Else
Throw New ApplicationException( _
"Invalid package name or location: " & packagePath)
End If
myPackage.Variables.Item("Beg_Date").Value = startDate
myPackage.Variables.Item("End_Date").Value = endDate
myPackage.Execute()
问题是这要求用户在本地安装 SSIS。
My DBA has several SSIS packages that he would like the functionality of providing the end user with a way to input values for variables in the package. What would be the best solution for creating an application that would take the user input and pass the data through to the SSIS package variables?
I have looked at http://blogs.msdn.com/b/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx , and I have even come pretty close with some of the information here - http://msdn.microsoft.com/en-us/library/ms403355(v=sql.100).aspx#Y1913 .
I can get this work locally using this code
Dim packageName As String
Dim myPackage As Package
Dim integrationServices As New Application
If integrationServices.ExistsOnSqlServer(packageName, ".", String.Empty, String.Empty) Then
myPackage = integrationServices.LoadFromSqlServer( _
packageName, "local", String.Empty, String.Empty, Nothing)
Else
Throw New ApplicationException( _
"Invalid package name or location: " & packagePath)
End If
myPackage.Variables.Item("Beg_Date").Value = startDate
myPackage.Variables.Item("End_Date").Value = endDate
myPackage.Execute()
Problem is this requires that the user have SSIS installed locally.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用变量作为配置并在运行时传递它们。我们使用调用子包(具有变量)的父包来执行此操作,但我相信也可以通过这种方式直接在对包(您可以动态创建)的调用中发送它们。
您可以将变量存储在配置表中,并让用户通过 t-sql 更新配置表,然后也调用该包。仅当每个用户有不同的父包或者用户无法同时运行以避免竞争条件时,这才有效。
You can use variables as the configuration and pass them through at run time. We do this with parent packages that call child packages (which have the variables) but I believe it is possible to send them directly in the call to the package (which you could create dynamically) this way as well.
You could store the variables in a config table and have the user update the config table through t-sql and then call the package as well. This would only work if you have different parent packages for each user or there is no way that users would be running at the same time to avoid race conditions.