RAISERROR not triggering Event Handler from an Execute SQL Task
I have an Execute SQL Task that does a SELECT COUNT(*) on a table, and if the table has no rows, it raises an error..."if @RowCount = 0 RAISERROR('Error Message',16,1)". I created an Event Handler on the Execute SQL Task which then logs the error to a logging table. The problem I'm having is that the Execute SQL Task fails as I would expect, but the Event Handler is not triggered and doesn't log the failure. Why doesn't the Event Handler get triggered from the RAISERROR code?
April 7th, 2011 11:19am

You should rather use a precedence constraint to trigger an action. Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2011 11:39am

My issue is not the same, as the Execute SQL Task does actually fail. I just don't understand why the Event Handler is not triggered from the failure. Also, my Execute SQL Task is inside a Foreach Loop Container. I don't want the failure of the Execute SQL Task to cause an error in the parent Foreach Loop Container. I implemented this by creating the Event Handler for the Execute SQL Task, with the Propagate value set to False for the Event Handler. Because the Event Handler is not being triggered, the Foreach Loop Container is receiving the error, which the behavior I'm trying to avoid.
April 7th, 2011 11:51am

... my Execute SQL Task is inside a Foreach Loop Container. I don't want the failure of the Execute SQL Task to cause an error in the parent Foreach Loop Container. I implemented this by creating the Event Handler for the Execute SQL Task, with the Propagate value set to False for the Event Handler. Because the Event Handler is not being triggered, the Foreach Loop Container is receiving the error, which the behavior I'm trying to avoid. You set the value to false, what if you set it to true? Why then not to set the ForEach Loop FailPackageOnError to false? Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2011 11:56am

There are other steps inside that Foreach Loop container that may fail where I do want the package to fail, so setting the FailPackageOnError variable to false is not an option. The Execute SQL Task is the only step where I want an error logged by the Event Handler, and then "ignored" (which is why I set the Propagate value to FALSE) so that it keeps looping.
April 7th, 2011 2:15pm

Do any of the mods or anyone else know why this is occurring?
Free Windows Admin Tool Kit Click here and download it now
April 11th, 2011 2:37pm

Did you try somehting like RAISERROR('Error Message',16,1), the exeute sql taks catched error when the severity is increased, thought 1ts should be hog priority errorAbhinav
April 11th, 2011 3:46pm

I've tried using different values for Severity and State values, and nothing has worked so far.
Free Windows Admin Tool Kit Click here and download it now
April 11th, 2011 5:02pm

As I ran a test, RaiseError raise OnError event without any problem. did you try to execute whole package or just execute special task? try to execute whole package and let us know the result.http://www.rad.pasfu.com
April 12th, 2011 12:27am

Thank you Reza. When I run the whole package, the Event Handler fires as it should. When I was testing it before, I was only running the Sequence Container than contained the Foreach Loop Container. I still don't quite understand why it fails then, but I'm glad it works when running the whole package.
Free Windows Admin Tool Kit Click here and download it now
April 12th, 2011 3:52pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics