I was wondering how can I get the value of System::TaskName of a higher scope when I have a Master Package that have several sequence task, data flow tasks and execute package tasks. For each task inside this Master Package on the Post-Execute event handler I have a script task that logs the execution of each task.
After running this master package I saw in my db that I have a row for every single tasks executed in the process and not only the tasks that exist in the master package. For instance, for simplicity let's say my master package looks like this:
SQL Task Script
|
Exec Package 2
|
Exec Package 3
|
Exec Package 4
Package 2,3 and 4 have a SQL Task Script with name Execute SQL Task Package 2, Execute SQL Task Package 3, Execute SQL Task Package 4.
Here's what I got in my db:
Execute SQL Task
Execute SQL Task Package 2
Package2
Execute Package 2
Execute SQL Task Package 3
Package3
Execute Package 3
Execute SQL Task Package 4
Package4
Execute Package 4
I see two TaskName variables in the Variable window, one with OnPostExec scope and the other with Execute Package 2 for instance. I want to get the value of System::TaskName with Execute Package 2 scope.
I want to see in my db only the tasks in bold. Any ideas of how can I do this? I hope you understand what I'm trying to achieve.
Thanks!
Each eventhandler has a variable called @.[System:ropogate] which should be all that you need.
System Variables
(http://msdn2.microsoft.com/en-us/library/ms141788.aspx)
I could tell you how to use it but you'll probably learn more by fiddling with it yourself. its fairly self-explanatory.
-Jamie
|||Hi Jamie,I knew about the Propagate variable and I tried setting it to false for every post-execute event handler in my master package. I still got multiple records in my table.
Then I tried with False at the package level on every subpackage my master package is calling but I got the same results.
Finally, I remove all my post-execute event handlers from my master package and leave just one, at the master package level and set the Propagate to false and I still got all the subtasks logged into my table.
Could you tell me how to use this variable?
Thanks!|||
You need to set it on the eventhandlers that are scoped to the tasks for which you don't want to do any logging. So, if you have a task called "Ricardo's Execute SQL Task" in a child package that you don't want to capture information for, set that task's eventhandlers to ahve System:ropogate=FALSE.
-Jamie
|||Hi Jamie,Well, I guess I'm doing something wrong because I set to False the Propagate variable on the Execute SQL Task of my first child package and also at the package level. So now, the Post-Execute event handler for these two objects have nothing but I changed the value of Propagate from True to False.
In my parent package, I disabled all the post-execute event handlers except for the Execute Package Task that calls Package 2.
I got 3 rows inserted in my table:
Taskname = Script Task Post-Exec Package 2 - SourceName = Execute SQL Task Package 2
Taskname = Script Task Post-Exec Package 2 - SourceName = Package2
Taskname = Script Task Post-Exec Package 2 - SourceName = Execute Package 2
the values from above are from System::TaskName and System:ourceName
Thanks!
No comments:
Post a Comment