SSIS send mail for errors [duplicate]

一曲冷凌霜 提交于 2020-01-25 08:59:07

问题


How can I send emails with error details if there is any error in package execution? Basically how can I get error details and put them in Message of Send mail task?


回答1:


Here is the example :

Let's say i have one sql task , i want to get the email on "task failure" with the description of error .

  1. Now drag the email task and give precedent constraint from sql task to email task on failure .
  2. With in email task , give smtp connection, from, to email address , subject , message .. etc
  3. Create the user variables for error message
  4. Set the event handler for task failed or on error and create the script task with in package level .
  5. In script task .. we need to assign the system variables and user variables .
  6. Make sure the properties -- disable event handler should be false then only it will read the system variables .

Finally execute the package .. if any error occurred then you will get the email with the description .

Thanks

R




回答2:


This is what we do. We use the logging system of SSIS to log all errors to a table.

Then create an event handler at the package level. IN the event handler I send an email when something fails that contains the name of the package (which we always havea as a variable), the name of the task that failed (use variable System::SourceName for this, took me a while to find it.) and a query of the logging tables to enable the support team to quickly pull up the details (part of the body of the email, I use a variable but you don't have to).



来源:https://stackoverflow.com/questions/2460117/ssis-send-mail-for-errors

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!