Reduce Multiple Errors logging in sysssislog - ssis

Need help. I am trying to automate error notifications to be sent in mailers. For that I am querying the sysssislog table. I have pasted an "Execute SQl task" on the package event handler "On error". For testing purpose, I am deliberately trying to load duplicate keys in a table which consists of a Primary key column(so as to get an error).
But instead of having just one error, "Violation of primary key constraint", SSIS records 3 in the table. PFA the screenshot as well. How can i restrict the tool to log only one error and not multiple ???
Package Structure.
Package ("On error Event handler") - > DFT ->
Oledb Source - > Oledb Destination
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_SalesPerson_SalesPersonID'. Cannot insert duplicate key in object 'dbo.SalesPerson'.".
SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "OLE DB Destination Input" (56)" failed because error code 0xC020907B occurred, and the error row disposition on "input "OLE DB Destination Input" (56)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (43) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (56). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Please guide me. Your help is very much appreciated.
Thanks

Try using the following query.
SELECT *
FROM dbo.sysssislog
WHERE sourceid IN (SELECT DISTINCT sourceid FROM dbo.sysssislog WHERE event = 'PackageStart')
Notice the sub-query inside the where clause? By doing this we'll only be selecting the rows having sourceids which appear in PackageStart events. PackageStart events always have the top-level sourceids and never the subcomponent sourceids. So, with the where clause in place, you are effectively filtering out all of the subcomponent or "multiple" error messages. Take a look at the FirstError column of the query inside this article.

By design all the task level errors "bubble up" to the package level and hence you see the multiple errors. If you need only 1 error message, you will need to differentiate the source of the error i.e to say, where it is coming from. That can easily be done through the SourceName column (or in fact the TaskID). If you are using out of the box logging, these columns might not be available. Writing a custom logging script is not that tough though.

Related

Varchar(number) causes failure in SSIS

I'm developing a pretty straightforward SSIS package: run a stored procedure to export data from a variable table directly into a flat file destination. Originally, each column in the variable table was defined as varchar(max), worked fine so far. For improve the performance, I decided to apply constraint to the variable table, which is not compatible with varchar(max) and I had to assign a certain number to it, e.g. varchar(10). After this change, this SSIS suffered from a series of error:
Error: 0xC0202009 at ESP AL Extract, OLE DB Source [835]: An OLE DB error has
occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "Microsoft SQL Native Client"
Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated
errors. Check each OLE DB status value, if available. No work was done.".
Error: 0xC0208265 at ESP AL Extract, OLE DB Source [835]: Failed to retrieve
long data for column "SR_RequestID".
Error: 0xC020901C at ESP AL Extract, OLE DB Source [835]: There was an error
with output "OLE DB Source Output" (846) on component "OLE DB Source" (835).
The column status returned was: "DBSTATUS_UNAVAILABLE".
Error: 0xC0209029 at ESP AL Extract, OLE DB Source [835]: The "output
"OLE DB Source Output" (846)" failed because error code 0xC0209071 occurred,
and the error row disposition on "component "OLE DB Source" (835)" specifies
failure on error. An error occurred on the specified object of the
specified component.
The flat file columns data type is string[DT_STR]. Any thought is appreciated.
Try this :-
Right Click OLEDB Source and select Show Advanced Editor.In the Input Output Properties expand the Oledb Source output and Output Columns.Select the column and change the data type to String[DT_STR] with the length of 10.
Reason you are getting an error is because when you first created your stored procedure with the data type varchar(max) ,SSIS converted the column to DT_TEXT.So once the column data type was changed to varchar(10) ,SSIS failed to convert varchar to text stream .Hence failed .

SSIS Multicast Issue: Weird behavior

I am working on Integration services and came across a weird bug.
My data flow consist of:
-> DESTINATION
SOURCE -> SCRIPT_COMPONENT -> MULTICAST /
\-> DESTINATION
This error always occurs but differs the columns that is being addressed:
Error: 0xC0202009 at *STAFF_MIGRATION*, *STAFF_BASE* [627]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
Error: 0xC020901C at *STAFF_MIGRATION*, *STAFF_BASE* [627]: There was an error with input column "*LAST_UPDATED_BY*" (651) on input "OLE DB Destination Input" (640). The column status returned was: "The status value given to the provider was not valid.".
The column LAST_UPDATED_BY differs to sometimes LAST_UPDATE_DATE
The weird behaviour is that this doesnt occur if I add Data Viewers along the path to the destination.
Any ideas?
EDIT: I am running on VS/BIDS 2008 SPI and SQL Server 2008 (RTM) x64 SP1.
EDIT: I am now running on SQL Server SP3 and still the behavior occurs.
I think my theory could be right. When I place a data viewer, it means it needs to build the data set for me to view prior to insertion. So the values for the columns must be built. I found a solution by making the destination a fast load table where bulk insertion is intended. That would mean it would have time to build the data and would not encounter the invalid value for columns.. It was just a wild guess but it worked

Multiple SSIS Package errors

I have an SSIS package that was built 3 years ago by someone else that is long gone. I have ran it multiple times over the past year, and now I am getting these errors and I do not know why they are coming up. This ssis package imports from an excel doc to a temporary table. Once the info is on the temp table the second time it is run, it takes from the temp table and inserts it with additional columns into the production table. These are the errors I am getting:
[OLE DB Destination [162]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has
occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult:
0x80004005 Description: "Unspecified error".
[OLE DB Destination [162]] Error: There was an error with input column "UserProfileID" (299) on
input "OLE DB Destination Input" (175). The column status returned was: "The value violated the
integrity constraints for the column.".
[OLE DB Destination [162]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The
"input "OLE DB Destination Input" (175)" failed because error code 0xC020907D occurred, and
the error row disposition on "input "OLE DB Destination Input" (175)" specifies failure on
error. An error occurred on the specified object of the specified component. There may be
error messages posted before this with more information about the failure.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on
component "OLE DB Destination" (162) failed with error code 0xC0209029 while processing input
"OLE DB Destination Input" (175). The identified component returned an error from the
ProcessInput method. The error is specific to the component, but the error is fatal and will
cause the Data Flow task to stop running. There may be error messages posted before this with
more information about the failure.
When I saw "error with input column 'UserProfileID'" i looked at it in the temp table and it is null. This is one of the columns that the package is supposed to find when it is run. But I don't know if that info is found with the second run or if it is supposed to populate the first time. So I am unsure if that is what the problem I am having is.
I appreciate any help that I can get. If any additional info is needed I can try and provide it. Thank you to anyone that can offer help.
Has the table had it's structure changed recently? If the field did not have a constraint before, and has one now, then you need to address the issue in your SSIS package to move any records which do not meet the constraint to an exception table or you need to find out why the constraint was added when it is not appropriate for the type of data being imported.
The next place I would look is the Excel file. When a package has been running a file for some time and suddenly has problems and there have been no changes to the structure of the table the data is being inserted into, then it is likely the data in the file is wrong.
I think the important part of the message is:
"The value violated the integrity constraints for the column."
Does your destination allow null values in that field?
Can you insert the row manually?
If you take out the rows with null values in that field, does it run successfully?
re: your comment
the file I have been assured has no mistakes in it
If you can identify rows that won't import because of null values in a field, can you send that set back and ask the guy if the rows are valid, because they're breaking the import?
OK, from your additional information, I can see the problem is the null value in the userProfileID field which doesn't allow nulls. The question then becomes, what process is supposed to correctly determine the userProfileID value? Is it the updateIDs step? Is it copied directly from the Excel input file?

ssis sql 2000 image to 2008 varbinary Failed to retrieve long data for column

I have a task that to migrate the image type column from sql 2000 to varbinary type in sql 2008.
The source column having 3812353 max datalength size for the column.
The package always failed with following error message.
[OLE DB Source [13177]] Error: Failed to retrieve long data for column "attch_file_content_t".
[OLE DB Source [13177]] Error: There was an error with output column "attch_file_content_t" (13209) on output "OLE DB Source Output" (13187). The column status returned was: "DBSTATUS_UNAVAILABLE".
[OLE DB Source [13177]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "output column "attch_file_content_t" (13209)" failed because error code 0xC0209071 occurred, and the error row disposition on "output column "attch_file_content_t" (13209)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
It basically was the connection error.
i manage to solve the connection issue on one table but now found another issue on another table.
The initial intention is migrate the source data to staging.
The source are sql 2000, they have some attachment as an image type
Then we have the Failed to retrieve long data for column issue when we just do the select * from tableA
Then I try to do the select cast(ImageTypeColumn) as varbinary(8000) from tableA
now it work for those data which is not exist 8000 byte
But unfortunately in the another table, there exist some rows data length is huge.
Thus it failed again when we do the select cast(ImageTypeColumn) as varbinary(8000) from tableA
In Microsoft SQL Server 2000 and earlier versions, the varbinary data type had a maximum limit of 8,000 bytes. To store up to 2 GB of binary data the image data type needs to be used instead.
Finally i found a solution on that.
Using ADO.net Source instead of using the OLEDB.net Source

SSIS IsNumeric expression Error

Hi am using following exression in ssis package
!ISNULL((DT_I4)Route) ? (DT_WSTR,50)("SB" + SUBSTRING(RIGHT(Route,2),1,1)) : (DT_WSTR,50)Route
when the Route value is Numeric it is sucess, when it is Non-numeric failing with
following description. Any help,how to resolve this issue
[Derived Column [111]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Column" (111)" failed because error code 0xC0049067 occurred, and the error row disposition on "output column "column_New" (679)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (111) failed with error code 0xC0209029 while processing input "Derived Column Input" (112). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
The following part of your conditional statement "(DT_I4)Route" is attempting to cast Route as a 4 byte Integer. You do not need to cast Route to a DT_I4 to test for Null.
EDIT --
I had missed that you were trying to test for non-numeric.
So here is how I would do this:
In your derived column transform have one column that has the expression (DT_I4)Route and one column where the expression is (DT_WSTR,50)Route
On the Column that is derived from (DT_I4)Route set the Error Output to Redirect Row
On the Error Output flow have a second Derived Column that uses the expression
(DT_WSTR,50)("SB" + SUBSTRING(RIGHT(Route,2),1,1)) that is named the same as your column from the first derived column transform, and use a Union ALL to merge them back together.
From my testing, the expression you used returns null as soon as you encounter an error (and casting an non-numeric to a DT_I4 is an error) but only if you have your error output set to something other than fail component. Ignore Failure won't work since you will then just get null for the whole expression where the value is non-numeric.