Passing variables in SSIS pckg

  • I am trying to pass a variable from 1 sql task into other to extract some data from source. running into problems when setting the varibles as Input and Output for both sql tasks

    Has anyone tried this before?any links or any exampels where similar process has been implemented will be of great help. TIA

  • Have done this many times.

    What part is causing you trouble? The passing of the value INTO the next step or getting the value OUT of the previous step?

    CEWII

  • Thanks for the response . infact i am having trouble storing the value into a variable as i dont see it when i debug the task. so prettty much both storing in a variable and using that variable for another task. any suggesti0ons will be of great help. tIA

  • So am I right in thinking that you are attempting to use an Execute SQL task to retrieve a single figure and then to store that figure in a variable for use later in the package?

    Can you confirm the data type and scope of the variable?

    Perhaps you could attach a screen shot showing how the Execute SQL task is configured, showing the SQL Source and the properties - that will help us diagnose what is going wrong.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • attached is the document with snapshots. yes i have 2 sql execute tasks 1st one passes a variable to 2nd one which uses that variable to pull data from source connection

  • I think you need to change this code inside the script task:

    from tablea a, tableb b

    where a.familyid = b.familyid

    and b.groupid = [user::GroupID]

    to this:

    from tablea a, tableb b

    where a.familyid = b.familyid

    and b.groupid = ?

    SSIS uses ? to represent passed in parameters, the order they are used in the sql code needs to be the same as the order they defined within the parameter mapping screen of the task

  • Tried substituting the variable with ? instead of User::GroupID.Still not able to get it work. Am i missing anything in initial setting? any suggestions please?? TIA

  • Does the code work if you type in the value rather than trying to pass in a parameter?

  • Yes it does. I followed this link for setting the variables. Thanks

    http://www.sqlis.com/post/The-Execute-SQL-Task.aspx

Viewing 9 posts - 1 through 8 (of 8 total)

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