Raise an Event
Hi
What is the simplest way to raise an event from within a Control Flow
or Data Flow so that my OnWarning event handler fires?
If I come across business errors during my ETL, I want to raise these as warnings so that my master package OnWarning event handler can log them to our custom logging database.
Amir
May 12th, 2011 11:38am
You meant you need to pass an event back to the parent package. I think this post can help you:
Passing a values back from a child package to a parent package in SSIS
http://vsteamsystemcentral.com/cs21/blogs/steve_fibich/archive/2007/09/29/passing-a-value-back-and-forth-from-a-parent-package-to-a-child-package-in-ssis.aspxArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2011 11:53am
Hi Arthur
Thanks for your reply.
I can see this working for passing back values, however, I want to be able to continue processing from where the child is. Hopefully, the following might help better explain what I am trying to do:
Master Package Start
--> Child Package
----> Child Package Task1
----> Child Package Task2
----> Child Package Task3
---------> Raise Warning 1
--> Master Package::OnWarning handler logs the warning
----> Child Package Task4
----> Child Package Task5
---------> Raise Warning 2
--> Master Package::OnWarning handler logs the warning
----> Child Package ...
Master Package End
At the end of the above sequence, two warning will have been logged by the Master Package (raised by the Child package)
Is this possible? Amir
May 12th, 2011 12:13pm
Try this: enable logging in your parent package and choose each of your execute package tasks. In the Details tab check OnWarning. Make sure that the property LoggingMode of each Execute Package task is set to UseParentSetting.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2011 1:40pm
Hi Amir,
configure event handler for the package and enable logging for the package. this will satisfy your need.
I am surprised about the specify word called Business Errors - what do you mean by that? I assume that you wish have custom handler.
Thanks,
Ayyappan
http://sqlserverrider.blogspot.com
May 12th, 2011 1:59pm
A custom event may do you better than tracking Warning events.
But to answer your question directly - from either the Script Task or the Script component (Control flow or data flow, respectively) you can fire a warning (or custom) event.
From the Script Task, use Dts.Events.FireWarning(...). From the Script component, use ComponentMetaData.FireWarning(...)
Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2011 2:25pm
Thanks Ayyappan.
By "Business Errors", I meant non-fatal issues e.g. dirty data. I want to raise these as warnings but not fail the ETL.
Amir
May 13th, 2011 8:48am
Hi Todd
Thanks for the pointer. I have implemented the FireWarning suggestion and it is working very nicely.
Amir
Free Windows Admin Tool Kit Click here and download it now
May 13th, 2011 8:49am
Thanks Arthur.
I have implemented Todd's solution.
Amir
May 13th, 2011 8:51am
Here is an other example:
http://microsoft-ssis.blogspot.com/2011/02/script-task-and-component-logging.html
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
May 13th, 2011 12:26pm