Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DTS Error Logging

Posted on 2011-03-23
4
Medium Priority
?
300 Views
Last Modified: 2012-05-11
Recently we received an error using one of our scheduled DTS packages. The problem was due to bad data, however the error logging is extremely generic and it took me quite a while to find the specific row that contained the bad data.  I reran the step and was able to determine that the problem occurred after the 39000th record and before the 40000th record, but that's the best I could get.   I removed that record, and everything ran fine.
My question is, is there a way to make the error logging more specific?
Do you know of any way to identify the record causing failure in a better way?  If that's not possible, is there a way we can set the record number display to be less than 1000?  Something like 100 might make it easier to narrow down an offending record.  50 or 25 would be even better.

Thanks in advance.
0
Comment
Question by:Goosie1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 35202353
I assume you are talking about SQL 2000 DTS packages and you should enable logging as described at the link below:

http://msdn.microsoft.com/en-us/library/aa216427(v=sql.80).aspx

However...if you know that a (I assume) data transfer task could fail because of bad data then I suggest you include a data validation task before that and fail the package at that point sending an alert as well - or even better - do that first in your package why waste time and maybe rollback needed to wait for that task.
0
 

Author Comment

by:Goosie1
ID: 35206855
First let me say that I am a very new user to DTS. I am using SQL 2000 DTS packages. I have the enable logging turned on. My problem is that the logging is not specific as to what data caused the error.  Your suggestion to include a data validation first is a good one. However I am unsure how to do this? Can you advise?
0
 
LVL 40

Expert Comment

by:lcohan
ID: 35207148
You do have a query that you can run against the source table(s) to find bad data right? I mean you deleted bad records from the source table then your SSIS import worked well so you should take that same query and put it in a IF EXISTS statement and if indeed there's bad data or in other words the IF EXISTS evaluates true then you could generate for instance an error right there so the package will fail. I did this (cheap I know) but it works perfectly in 2000 where I create a temp table with PK and force duplicate values that will generate an error. Well obviously this being tied to the IF EXISTS step I can use RAISEERROR and change the message from pk violation to whatever you want and this will be logged as well - something like in the code below:

declare @msg varchar(400)
create table #test (col1 int primary key)
--test if bad data exists
if exists (select * from source_data where bla = bla)
begin
      insert into #test values (1)
      insert into #test values (1)
      
      set @msg ='Operation Failed!!!'+char(13)+'Please check Data Source table'
      if @msg is not null
      RAISERROR (@msg, 16, 1) with log
end
drop table #test
go


0
 

Author Comment

by:Goosie1
ID: 35333587
I found the logging in the data pump task is exactly what I was looking for. It prints out the data that causes the step to fail. Thanks very much for leading me to this!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

721 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