Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

How to find the parent package

$
0
0

Hi,

The problem I'm trying to solve is, given an instance of a SSIS package being executed, I need to find the GUID and execution id of the package that calls it. According to the API (https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.aspx) the Package class

has a property "Parent", which returns the instance of the container that contains the child package. In reality though, this doesn't seem to work. Here's what I did,

1. Create a child package that simply has a script task which writes a line to a file for debugging purpose.

2. Create a custom SSIS component in which the child package is called by the myPackage.Execute() method;

3. Given the reference myPackage, try to print the parent container id through the FireInfo() method from IDTSComponents interface.

What I got was an "reference not set to an object" error, which means the parent property is null. This leads me to wonder, when is the parent property set? Is it only set during the execution of the child package? I tried to access it both before and after executing the child package, and in both cases the value was null.

My ultimate goal is to write the parent package id (and execution id) into the ssis log so as to easily trace the execution of packages. Another option to achieving this goal would be through passing values via parent package variables but that seems to be too clumsy. 

Any help / suggestion is greatly appreciated.

Regards,

Amos


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>