Variable scope
Hi, I have been reading about variable scope and still confused about what I am looking at.
My project consists of several packages but for some reason no matter what package I open, they all have the same variable scope. They actually all have the scope of the vary last package I created.
Can someone shed some light on this...? I am totally lost here.
Thanks, Dmitry.
May 24th, 2011 8:55pm
I've just loaded a project with multiple packages and the scope changes each time I switch between packages so I'm not sure what's happening in your environment.Jeff Wharton MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt) MCT, MCPD, MCITP, MCDBA Blog: MrWharty.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2011 9:26pm
What is the purpose of a scope if it changes....? Isn't scope means that a variable is available for a package....? I am new to SSIS and I am confused here.
I created a package_1 with 3 variables. I created a package_2 with 2 variables with the same names as package_1. After my master_package executed both packages my package_1 has 3 variables with all scopes = "package_2".
Dmirty
May 24th, 2011 9:39pm
What is the purpose of a scope if it changes....? Isn't scope means that a variable is available for a package....? I am new to SSIS and I am confused here.
A variable is created within the scope of a package or within the scope of a container, task, or event handler in the package. Because the package container is at the top of the container hierarchy, variables with package scope function like global variables
and can be used by all containers in the package. Similarly, variables defined within the scope of a container such as a For Loop container can be used by all tasks or containers within the For Loop container.
Therefore, variables created in Package_1 will not appear in Package_2 and vice versa
I created a package_1 with 3 variables. I created a package_2 with 2 variables with the same names as package_1. After my master_package executed both packages my package_1 has 3 variables with all scopes = "package_2".
Are you sure this is not hust a screen refresh error as I have just tested this and the scope of my variables is still correct? Jeff Wharton MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt) MCT, MCPD, MCITP, MCDBA Blog: MrWharty.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2011 9:49pm
I have several packages running sequentially. The packages that already ran all have variable scopes reset to a single package name. The packages still under construction have variable scopes set correctly. Could it be related to Package Configurations....?
Could I have set something wrong and all scopes got reconfigured to a single package...?
OK, I opened Package Configuration Editor and the first field under Objects: is the name of the package which reset all scopes. Does this mean the Package Configuration Manager control all scopes for all variables...? I guess this was
the very last package I used to set up Package Configurations.
Confusing indeed.
Dmitry.
May 24th, 2011 11:38pm