April 29, 2008 at 12:36 pm
Hi, All
I have a Send Mail Task on my EventHandlers. It captures ErrorSource, PackageName and ErrorDescription and send emails to my dayawarehouse group. It only sends one email, in case of PK voliation it sends to email -one for PK voliation and another one for StoredProcedure that is trying to insert data.In case of PK voilation I don't have error number.here are the 2 Errors example--(this one has error number )
"Executing the query "EXEC usp_LoadtPhoneMasterInsert" failed with the following error: "The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. "
the second one is -----
Violation of PRIMARY KEY constraint 'PK_tPhoneMaster'. Cannot insert duplicate key in object 'dbo.tPhoneMaster'.
The problem today--( i can servive with this 2 emails).BUt, It send more than 80 emails at the same time for the same package like this ----------
Checking identity information: current identity value '5', current column value 'NULL'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
The statement has been terminated.
Violation of PRIMARY KEY constraint 'PK_tBPWeb_PhoneDetails'. Cannot insert duplicate key in object 'dbo.tBPWeb_PhoneDetail'.
The statement has been terminated.
Violation of PRIMARY KEY constraint 'PK_tBPWeb_PhoneDetails'. Cannot insert duplicate key in object 'dbo.tBPWeb_PhoneDetail'.
The statement has been terminated.
Violation of PRIMARY KEY constraint 'PK_tBPWeb_PhoneDetails'. Cannot insert duplicate key in object 'dbo.tBPWeb_PhoneDetail'.
The statement has been terminated.
Violation of PRIMARY KEY constraint 'PK_tBPWeb_PhoneDetails'. Cannot insert duplicate key in object 'dbo.tBPWeb_PhoneDetail'.
The statement has been terminated.
Is there anyway to limit this just to 1 or 2 emails so that my dataware house doesn't receive more than what they need.
Thanks
April 29, 2008 at 12:47 pm
One of the easier ways of handling this is to create a package level boolean variable set to False.
In your event handler, check if the variable is true - if it is not, send the email and then set the variable to true.
You could also have the package stop entirely after your email is sent, but if you are logging errors, you may stop the logging of something useful.
April 29, 2008 at 9:12 pm
Thanks Michael , I will try your first option tomorrow.
I think i am not clear in explaning my problem. I want to send email as weel as log the problem in the table. usually, it send emails and also log the error in the audit event table. But there is this one package when run without truncating table , voilates PK insertion and this column is identity column, . SO as a results it fires more than 80 emails becoz i belive it voilates insertion in eack row. and same error is logged more than 80 times in the table. I know its the same Problem so all i want is just insert one error in teh table and send just one email.
U see above the sample of the error..... All error say PK voilation and statement is terminating, so usually in other casaes i get to emails, one for PK voilation and one for statement terminating.
In this package more than 80 emails and 80 errors log is the problem
thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply