1

I have package variable (TableName), its value is set by for each loop container.

For instance TableName = sales set by for each loop after looping through informationschema.tables then I want to use TableName's value in dataflow for this I am using script component.

When I use script component to read TableName's value in script-file I cannot see variable any idea why??

I am using script component as source and TableName is in readonlyvariables.

Please help as I am new to SSIS. enter image description here

shaadi
  • 161
  • 2
  • 4
  • 21

3 Answers3

0

On the Variable Mappings page of the Foreach Loop Editor, assign variables to each item of data that is returned by a single enumerated item. For example, a Foreach File enumerator returns only a file name at Index 0 and therefore requires only one variable mapping, whereas an enumerator that returns several columns of data in each row requires you to map a different variable to each column that you want to use in the Script task. +

After you have mapped enumerated items to variables, then you must add the mapped variables to the ReadOnlyVariables property on the Script page of the Script Task Editor to make them available to your script

For more details pls chk the below link

https://learn.microsoft.com/en-us/sql/integration-services/extending-packages-scripting/task/using-variables-in-the-script-task

https://social.technet.microsoft.com/wiki/contents/articles/22194.use-ssis-variables-and-parameters-in-a-script-task.aspx

SQL006
  • 439
  • 6
  • 21
0

Please use the following Microsoft Documentation link - it describes differences between Script Task and Script Component, and gives small code samples, specifically on using Variables.

Ferdipux
  • 5,116
  • 1
  • 19
  • 33
0

as per this I need to use this.variables.myvariable

Thanks everyone.

shaadi
  • 161
  • 2
  • 4
  • 21