Solved

SSIS Add Error Logging

Posted on 2008-06-24
10
779 Views
Last Modified: 2013-11-30
SQL Server Integration Services

I use a data flow item containing multiple lookups to normalize a flat file input. The error output I save into a seperate table. This table contains the errors from all lookups. I would like to add an additional error code to identify which lookup caused the error.

How can this be done?
0
Comment
Question by:riffrack
  • 4
  • 4
  • 2
10 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 21854718
Are you referring to which particular lookup task caused the error, or what row from the lookup caused the error?
0
 
LVL 8

Expert Comment

by:drydenhogg
ID: 21854981
Bit of a hack but throw a column transform in there and add an additional column to the error output from the lookup specifying which lookup it was that failed.
0
 

Author Comment

by:riffrack
ID: 21856713
hi drydenhogg
I tried to do that but I receive the following error:
"The component does not allow adding columns to this input or output."

hi chapmandew
yes, I am referring to which particular lookup task caused the error
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 8

Expert Comment

by:drydenhogg
ID: 21856731
Do it prior to each lookup, so it appears as a column before you hit the error output.
0
 

Author Comment

by:riffrack
ID: 21856888
Sorry, but its not quite clear to me what you mean.

I am quite new to SSIS, can you explain it step by step?
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 21856940
OK, so each task has a succes and failure workflow right (green and red arrows).  For the failure of each task (red arrow), use an ExecuteSQL statement to log the task name , and the error.  Does that make sense?
0
 
LVL 8

Accepted Solution

by:
drydenhogg earned 500 total points
ID: 21856971
In the data flow, before the raw data goes through a lookup, put the derived column transformation within the flow to add a column specifying which lookup you are about to do, if the lookup fails, the output will include the data you added in the lookup.

You probably have a data source object with a green arrow going directly to a lookup object. Basically divert the green arrow to the dervied colum transform, and then from the transform back to the lookup.

Before each subsequent lookup you can alter the value to indicate which lookup you are about to do.

Within the derived column object you can specify a column name, under the derived column you can say '<add as new column>' and in the expression put the value such as 'CustomerID Lookup' or whatever is appropriate for your application.

When a row then errors on a specific lookup, the lookup which it failed on will be in that derived column, which will of been sent to the error output.
0
 
LVL 8

Expert Comment

by:drydenhogg
ID: 21856987
This is still a bit of a hack though, it's not pretty and will have a performance penalty.
0
 

Author Closing Comment

by:riffrack
ID: 31470066
Thanks a lot works fine, I was able to place the derived column after the lookup. That was exactly what I was looking for.
0
 

Author Comment

by:riffrack
ID: 21860036
Performance is not really an issue, as it will run once a month with less than 100'000 records.

Is there a recommended / elegant solution, which you would refer to as a hack?
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
export sql results to csv 6 36
Refresh Dev server with Production database 8 29
Query Syntax 17 36
Query group by data in SQL Server - cursor? 3 34
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question