Saturday 12 September 2020

Call child package Using Script task

Execute package task is used to call the child package (Another SSIS package). We can call the child package without using the execute package task.

Below are the way

Ø  Execute process task: we can create a batch file which call the package and finally we will call the batch file using the execute process task.

           Read more about this: 

          https://bageshkumarbagi-msbi.blogspot.com/2020/09/call-ssis-package-in-another-ssis.html

Ø  Script task: Using script task we will call the child package.

Read: Executing SSIS Package by using C# windows application

https://bageshkumarbagi-msbi.blogspot.com/2015/01/executing-ssis-package-by-using-c.html

 In this demo we will see how we can call the child package using Script task.

Child package:

Package name: DimDate.dtsx

Taking script task

                        
Calling the DimDate.dtsx package.

Writing the below code to run the child package.

public void Main()

                                {

            // TODO: Add your code here

            Microsoft.SqlServer.Dts.Runtime.Application myApplication = new Microsoft.SqlServer.Dts.Runtime.Application();

            Package myPackage = myApplication.LoadPackage(@"I:\ssis_example\SSIS\PackageTemplate\PackageTemplate\DimDate.dtsx", null);

           MessageBox.Show("Executing package");

            DTSExecResult myResult = myPackage.Execute();

            // Show the execution result

            MessageBox.Show("Package result: " + myResult.ToString());

            Dts.TaskResult = (int)ScriptResults.Success;

                                }

Let’s execute this package.

Start executing this package.

      

Call the child package and execute it. 

Showing the status of child package execution. The package executed successfully.

Thanks for reading J

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts