shan
shan

Reputation: 53

In SSIS how to load the package inside Script Task c# code

In SSIS Script task I am able to load the package by providing the full path as following, but on the server I don't know the exact path after deployment, Is there any way to load the package and its configuration file.

    public void Main()
    {
        Dts.TaskResult = (int)ScriptResults.Success;
        Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
        Package package = app.LoadPackage(@"C:\tfs01\AURA\DB\Main\Src\ReportSolution\AURA_ETL\AURA_ETL\DTS_PatientModel.dtsx", null);
    }

Upvotes: 1

Views: 1917

Answers (1)

billinkc
billinkc

Reputation: 61221

As always, the documentation is your friend.

Instead of calling LoadPackage, you need to use LoadFromSqlServer. LoadPackage pulls from disk, LoadFromSqlServer talks to the msdb.

Note that if you are working with the 2012 project deployment, it's an entirely different mechanism.

Upvotes: 1

Related Questions