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.
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.