how to pass variable from one package to another

Răspuns how to pass variable from one package to another

  • Saturday, August 18, 2012 7:15 AM
     
     

    hello everone,

    i am creating package  name "package 1"  where i am using Execute SQL task Component

    and in this package i am defining variable name result  its data type is object

    and in it i am executing query "Select id from test"  storing this result in above variable  "result" after this i am using

    execute package task componet from which i will call my second project name "Package 2"

    in package 2 i am using Execute SQl task component and in it i am executing query "select name ,age from test where id=?"

    now i want that id should come from my package 1 but i am not getting how to do it is it possible in SSIS

    Kindly provide some link or solution for this kind of problem.

All Replies

  • Saturday, August 18, 2012 8:07 AM
     
     

    Hi,

    I'd use package configurations; - http://msdn.microsoft.com/en-us/library/ms141682.aspx

    You may find Parent package variables meet your immediate requirements. However in the longer term I've always found storing your variables in SQL Server tables the most flexible.

    Kind Regards,

    Kieran.


    If you have found any of my posts helpful then please vote them as helpful. Kieran Patrick Wood MCTS BI,MCC, PGD SoftDev (Open), MBCS http://www.innovativebusinessintelligence.com/ http://uk.linkedin.com/in/kieranpatrickwood

  • Saturday, August 18, 2012 8:29 AM
     
     
    i am not getting how to set envoirment variables in child and paent package can ou provide me some link
  • Saturday, August 18, 2012 8:58 AM
     
     
    i am not getting how to set envoirment variables in child and paent package can ou provide me some link

    Please check the links below it will help you to enable configurations

    http://www.bidn.com/blogs/BradSchacht/ssis/1970/ssis-configurations-how-and-when

    http://www.bidn.com/blogs/mikedavis/ssis/155/passing-variable-values-from-parent-package-to-child-ssis

    http://msdn.microsoft.com/en-us/library/ms345179.aspx

    Regards,

    Anil


  • Saturday, August 18, 2012 12:09 PM
    Moderator
     
     Proposed Answer

    There are two options for passing variables values from a Parent Package to a Child:
    Script Task: http://microsoft-ssis.blogspot.com/2010/12/passing-variables-from-parent-package.html
    Package Config: http://microsoft-ssis.blogspot.com/2011/06/passing-variables-from-parent-package.html


    Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com | Twitter

  • Monday, August 20, 2012 6:08 AM
     
     

    hello everone,

    i am creating package  name "package 1"  where i am using Execute SQL task Component

    and in this package i am defining variable name result  its data type is object

    and in it i am executing query "Select id from test"  storing this result in above variable  "result" after this i am using

    execute package task componet from which i will call my second project name "Package 2"

    in package 2 i am using Execute SQl task component and in it i am executing query "select name ,age from test where id=?"

    now i want that id should come from my package 1 but i am not getting how to do it is it possible in SSIS

    Kindly provide some link or solution for this kind of problem.

    now i am getting problem  in this query

    select name ,age from test where id=?

    when i am mapping this query with the result which i have stored in previous package and then cliking on Parse query in execute sql task

    i am getting error

    TITLE: SQL Task
    ------------------------------

    The query failed to parse. Parameter Information cannot be derived from SQL statements. Set parameter information before preparing command.

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

    i am not getting how to resolve this error i have mapped parameter also kindly provide some link or solution for this error

  • Tuesday, August 21, 2012 8:35 PM
     
     Answered

    Hi Ajay,

    To what extent have you worked through the links already supplied?

    It's just that you seem to have re-asked your original question after you have been supplied with these links.

    I also recommend the following book; -

    http://www.amazon.com/MCTS-Self-Paced-Training-Exam-70-448/dp/0735626367/ref=sr_1_1?ie=UTF8&qid=1345581075&sr=8-1&keywords=MCTS+BI

    In particular I recommend you study chapter 3 of the above book. If the links already supplied don't answer your question after working through these links please articulate why in this thread and we will try and help you further.

    Kind Regards,

    Kieran.


    If you have found any of my posts helpful then please vote them as helpful. Kieran Patrick Wood MCTS BI,MCC, PGD SoftDev (Open), MBCS http://www.innovativebusinessintelligence.com/ http://uk.linkedin.com/in/kieranpatrickwood