May 5, 2016 at 4:31 am
Hi,
Am new to SSIS. Am using Data flow task to move data from source table to destination table.
I need to capture the error description, task name and Package name and store it in error log table.
currently am achieving it through Execute SQL task.But i want to use Script Task and store the error in the error log table.
Can some one help me to get this?
Thanks in advance.
May 5, 2016 at 6:45 am
this link has a couple of screenshots and an explanation that can help:
basically, SSIS has a built in error logging mechanism, and you can have it write to one or more locations, including a specific database.
so you could have it write to a file, a databas eand the windows event log, all at the same time.
Inside the script task itself, you can raise errors via code for "logical errors", or to log more detaila bout the error to help with debugging.
a crappy example below:
try
{
//--doing a bunch of work here
if(Datatable.Rows.Count==0)
{
//Raise my own logical event
Dts.Events.FireError(0, "Error in proc ProcessSpecialCSVFiles: ", "The datatable returned Zero Rows, when the expectation is there is always data, "", 0);
}
return true;
}
//catch all errors and log them!
catch (Exception ex)
{
Dts.Events.FireError(0, "Error in proc ProcessSpecialCSVFiles: ", ex.Message, "", 0);
return false;
}
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply