Execute Package Task and Global vars

  • I have a parent pkg and a child pkg. Within the child package I have a global var that i set based on certain conditions. I want to be able to pass back the value from this global var (in the child) to the parent (calling) package. If I can't pass it back, can I interrogate the child package after it's executed?

    Any ideas or help most welcome!

    Steve.

    Steve.

  • Hi Steve!

    Hey, check out this link (watch for wrap as always!)

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag01/html/DTS2000inAction.asp

    There is a paragraph or two on using the Inner Globabl Variables and Outer Global Variables in an Execute Package Task. You should be able to pass data back and forth using these. Also, you could write an activex task script to call your child package from your parent package, reference the child package global variables, and then execute the child package. If I were at work I could cut and paste some code that I use successfully to do this. Anyway, hope this helps some at least...

    Michael

    Michael Weiss


    Michael Weiss

  • I think the global variable passing is only one way.

    You'll be able to interrogate the child package and retrieve the values in the global variables if you defined them at design time. Check 'Using Global Variables with DTS Packages' in BOL, it explains how the scope is affected.

    As another option, that could be more flexible and useable with more than DTS, you could store the value in a table.

    Hope this helps

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    Edited by - phillcart on 09/04/2003 8:57:04 PM

    --------------------
    Colt 45 - the original point and click interface

  • Thanks for the replies. So the consensus is that the Globals are one-way only, bit of a pity really. Guess I'll have to change my logic/flow to make it work.

    THanks again.

    Steve.

    Steve.

  • Hi

    It is possible to transfer information from child to parent!

    Check out:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sql_dts_ssabi.asp

    Look for this chapter:

    Information Flow Between Child Packages and Parent Packages

    Codesample.

    In the master package, you do something like:

    Set DTSGlobalVariables("goMasterPackage_RESERVED").Value = oPKG

    Then in any child, child of child, etc., or later on in the parent, you do something like:

    Dim oMasterPKG

    Set oMasterPKG = DTSGlobalVariables("goMasterPackage_RESERVED").Value

    sProcess = oMasterPKG.GlobalVariables("gsProcess_Geog_Mktg_RESERVED").Value

    or

    oMasterPKG.GlobalVariables("gsProcess_Geog_Mktg_RESERVED").Value = "full" ' set for full processing

    HTH

    Lars

    quote:


    Thanks for the replies. So the consensus is that the Globals are one-way only, bit of a pity really. Guess I'll have to change my logic/flow to make it work.

    THanks again.

    Steve.


  • Hmmm ... so they get around it by effectively passing an object to the child package ... interesting.

    Hope this helps

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    --------------------
    Colt 45 - the original point and click interface

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply