Querying DTS Tables For Log Information

Today I was looking the SQL Server Agent jobs on one of my SQL Server 2000 production database servers.  I noticed one job that failed with a very cryptic error.  This was the error message reported:

DTSRun OnStart:  DTSStep_DTSDataPumpTask_6   DTSRun OnProgress:
DTSStep_DTSDataPumpTask_6; 1000 Rows have been transformed or copied.;
PercentComplete = 0; ProgressCount = 1000   DTSRun OnProgress:
DTSStep_DTSDataPumpTask_6; 2000 Rows have been transformed or copied.;
PercentComplete = 0; ProgressCount = 2000   DTSRun OnProgress:
DTSStep_DTSDataPumpTask_6; 3000 Rows have been transformed or copied.;
PercentComplete = 0; ProgressCount = 3000   DTSRun OnProgress: 
DTSStep_DTSDataPumpTask_6; 4000 Rows have been transformed or copied.;
PercentComplete = 0; ProgressCount = 4000   DTSRun OnProgress: 
DTSStep_DTSDataPumpTask_6; 5000 Rows have been transformed or copied.;
PercentComplete = 0; ProgressCount = 5000   DTSRun OnProgress: 
DTSStep_DTSDataP…  Process Exit Code 1.  The step failed.

Now looking at this error message does not really provide all the detail as to why and what failed.  So I did some searching through BOL, MSDB and Google and I finally found what I was looking for.  IF you have logging enabled on the DTS package (I do for all of mine) and have the option to write to SQL Server instead of a log file then you can query for the exact error message produced.  Here is what you need to do:

In SQL Server 2000 open up a Query Analyzer window and select ‘MSDB’ from the drop down or type in ‘USE MSDB’ and execute that and you will now be placed into the context of MSDB.  Next, look at the job that failed and notice the name of the of the DTS package being called.  Take the name and then type and execute the following T-SQL statement:

    select *
    from sysdtspackagelog
    where name = ‘SendCustomerData’  — this is the name of your DTS package
    order by starttime desc

In the result set look at the first record and look for the column that reads ‘lineagefull’ and copy that value in the first record.  The value will look something like this:  E1E90023-93EB-4355-B995-43A762AD43C1

After grabbing that value, execute the following T-SQL statements and use that value in the WHERE clause.

     select *
     from sysdtssteplog
     where lineagefull = ‘E1E90023-93EB-4355-B995-43A762AD43C1′ 

The table sysdtssteplog displays all of the tasks in the DTS package so 1 task equal 1 record in the table.  Scroll over to your left in the result set pane and look for a column called: 

errordescription

Here you will be able to view the actual error that was generated by one or more tasks in your DTS package!

I hope you found this helpful!