serializer serializer - 2 years ago 103 Question

Set SSIS database package path

I am trying to execute a SSIS package located in a database programatically.

I am using this API:

Imports Microsoft.SqlServer.Dts.Runtime

I have an image describing the path (in database) to package but I cannot figure out how to set the packagePath property properly in the LoadFromSqlServer method.

Here is the image describing my package path in database:

enter image description here

Answer Source

You will need to add a reference to Microsoft.SqlServer.Management.IntegrationServices. For me, it does not show up in the SQL Server folders and I could only find it in the GAC.


There's also a dependency from that assembly to


Sub Main()
    ' Do not fault me for my poor VB skills nor my lack of error handling
    ' This is bare bones code adapted from 

    Dim folderName As String
    Dim projectName As String
    Dim serverName As String
    Dim packageName As String
    Dim connectionString As String
    Dim use32BitRuntime As Boolean
    Dim executionId As Integer

    Dim integrationServices As Microsoft.SqlServer.Management.IntegrationServices.IntegrationServices
    Dim catalog As Microsoft.SqlServer.Management.IntegrationServices.Catalog
    Dim catalogFolder As Microsoft.SqlServer.Management.IntegrationServices.CatalogFolder
    Dim package As Microsoft.SqlServer.Management.IntegrationServices.PackageInfo

    ' Dimensions in your example
    folderName = "SSISHackAndSlash"
    ' dimCalendar in your example
    projectName = "SSISHackAndSlash2012"
    serverName = "localhost\dev2012"

    ' dimCalendar in your example (no file extension)
    packageName = "TokenTest.dtsx"
    connectionString = String.Format("Data Source={0};Initial Catalog=msdb;Integrated Security=SSPI;", serverName)

    integrationServices = New Microsoft.SqlServer.Management.IntegrationServices.IntegrationServices(New System.Data.SqlClient.SqlConnection(connectionString))
    ' There is only one option for an SSIS catalog name as of this posting
    catalog = integrationServices.Catalogs("SSISDB")

    ' Find the catalog folder. Dimensions in your example
    catalogFolder = catalog.Folders(folderName)

    ' Find the package in the project folder
    package = catalogFolder.Projects(projectName).Packages(packageName)

    ' Run the package. The second parameter is for environment variables
    executionId = package.Execute(use32BitRuntime, Nothing)

End Sub
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download