Monday, March 19, 2012

Email if errors Exists in the error tables

I am setting my error tables.What i want to do is.If i find any data within my error tables i want an email to be sent to me.

How can i achieve this?

Please let me know

How are you populating those tables? do you want to receive an email on the first/each error or do you want to receive a single email at the end?

|||

Create a SQL Task that returns a value if you want to send an email or not.

Put the returned value in a variable.

Conditionally branch to email if the variable has the found value.

The SQL could be something like SELECT COUNT(1) cnt FROM ErrorTable. Have the SQL task return a single row. In mappings put variable 0 into a variable such as FoundError.

Add an email task, connect the two. Double click the line (constraint) and set it to an expression such as

@.FoundError > 0.

Hope that helps.

|||one single email only

|||

sureshv wrote:

one single email only

Then, Larry's suggestion should work for you. Wait until all data flow are done and then use an Execute SQl task in control flow to check is there were any errors; then you can use an expression in a precedence constraint to decide whether the email should be sent or not. There are another threads in this forums that tackle the how-to-send-an-email question

|||

I have Sql task and in General Tab in the

sql statement : i type SELECT COUNT(1)
FROM dbo.hb_test_error

when i execute and see now it workes fine

result set: from none to singlerow

Then Result set Tab

Variable Name : User::FoundError

Result Name :any name

Then i connect to email task

In precedence constraint editor

Evaluation operator : expression

Expression AngryFoundError >0

i have this error

[Execute SQL Task] Error: Executing the query "SELECT COUNT(1) FROM dbo.hb_test_error" failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

How do i solve this?

|||Set Result Name to: 0 (that's a zero)

No comments:

Post a Comment