SSIS var scope and var passing between packages

  • In 2005 I am trying to pass a parameter to a package variable, and then pass this variable to child packages that are being executed from within this parent package. I am getting an error message 'error occured while assigning a value to variable' Also variables are not being recognised by child packages that have been executed within the parent package that holds the variable. If anyone could provide me with a quick example of use it would be appreciated.

  • Janette,

    How are you attempting to "pass this variable to child packages that are being executed from within this parent package"? Are you using a parent package configuration?

    -Jamie

     

  • Hi Jamie,

          Yes I am using parent package configuration. setting the configuration from the child and refernecing the var in the parent package. one other question.  does the variable in each package level have to be named differently in order to pass the variable down?

     

    Thanks Janette

  • Janette,

    No, you shouldn't need to do that.

     

    I'm struggling to see why this wouldn't work. Are the datatypes on the variables identical?

    -Jamie

     

  •       Yes I am using parent package configuration. setting the configuration from the child and refernecing the var in the parent package. one other question.  does the variable in each package level have to be named differently in order to pass the variable down?

    Parent Package configurations work top down, from parent package to child, not the other way around. So, you probably just want to reference the parent package variables, modify them as needed. They will be visible to you from the child package.

     

  • me again... think i have manged to get the var scoping working (had a look at some of your associated articles) However, I have just noticed that the correct value is not being held in the parent package variable.  I have an execute sql task and wanted to pass the output param to a package variable.  rather than the other way round.  What is the best way to do this? thanks Janette

  • I don't know much about this because I've never had to do it but I do know that Kirk has a very useful post here: http://www.sqljunkies.com/WebLog/knight_reign/archive/2005/10/05/17016.aspx that explains some of the syntax needed to do this based on what provider you're using to access the data.

    -Jamie

     

  • Hi Jamie,

      setting up the sql task parameter is fine. just have a simple query declare @LRun datetime

    set @LRun = (select * from JobStore)

    Param mapping:var name - LRun, direction - I, Data Type - Date, Param Name - @LRun

    However I thought that it's use was parameter input to package variable rather than the other way round.  so what I need to find out is if this can be done through execute sql task or is another item used to do this.

    Thanks Janette

  • any other thoughts/suggestions on this?

    Thanks janette

  • got the param passing to package variable working.  Within Execute SQL Task, I had been trying to use parameter mapping to output a parameter rather than the result set functionality on it's own.  Thanks Janette.

Viewing 10 posts - 1 through 10 (of 10 total)

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