Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

send notification error task level and package leve useing ssis script Expand / Collapse
Author
Message
Posted Tuesday, December 17, 2013 4:29 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 10:39 PM
Points: 211, Visits: 4,541
hi friends i have small doubt in ssis
how to send email noftification task level or package level errore useing ssis script task

here i create logging sqlserver table and maintain errore message in that table and i want send what evere errore messag come in ssislog table that message to send superiore though useing script task.

public void Main()
{

string EmailSender = "asrinu13@gmail.com";
string EmailRecipient ="srinudw22@gmail.com";
string EmailServer = "smtp.gmail.com";


string EmailBody = "Email from radiance server";
string Subject = "Email Testing";


MailMessage myhtmlMessage = new MailMessage(EmailSender,EmailRecipient,Subject, EmailBody);

SmtpClient mysmtpclient = new SmtpClient(EmailServer, 587);
mysmtpclient.EnableSsl = true;
System.Net.NetworkCredential crediantials = new System.Net.NetworkCredential(EmailSender, "balukumar");
mysmtpclient.UseDefaultCredentials = false;
mysmtpclient.Credentials = crediantials;

mysmtpclient.Send(myhtmlMessage);

Dts.TaskResult = (int)ScriptResults.Success;

Dts.TaskResult = (int)ScriptResults.Success;
}

here i need to add ssislog table information code in the above script .
please tell me how to write code to add ssislogtable meesage and send to superiores.


Post #1523603
Posted Wednesday, December 18, 2013 8:52 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, December 12, 2014 7:23 AM
Points: 2,128, Visits: 1,487
Is there a reason why you want to do this using a Script Task rather than creating an Event Handler and using the built-in Send Email Task?

Robert Sheldon has written a good article on how to create an Event Handler - https://www.simple-talk.com/sql/ssis/ssis-event-handlers-basics/

If you create an SSIS Package template that includes an Event Handler and then use that template as the basis for all your SSIS packages you'll get error handling 'for free' in your subsequent packages.

If you are fixed on achieving your requirements using a Script Task, then this link may be of help: http://technet.microsoft.com/en-us/library/ms136054.aspx

Regards
Lempster
Post #1524187
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse