all groups > sql server dts > july 2003 >
You're in the

sql server dts

group:

Need script for processing next row of data if error is encountered in row


Need script for processing next row of data if error is encountered in row Elgar Esteban
7/3/2003 7:14:19 PM
sql server dts:
Hi!

I am a newbie to DTS. Below is a sample code which copies
the data from a source text file to a destination text
file.

Assuming that there are 3 columns in the source text,
if one of the rows has a missing column (the last column),
DTS encouters an error and then stops processing the
succeeding rows. What is the best way to make DTS continue
processing those rows of data even if an error is
encountered (which is then logged into an error log).

Your help will be very much appreciated.

Thanks.

Elgar



'**********************************************************
************
' Visual Basic Transformation Script
'**********************************************************
**************

' Copy each source column to the destination column
Function Main()
DTSDestination("name") = DTSSource("name")
DTSDestination("company") = DTSSource("company")
DTSDestination("phone") = DTSSource("phone")

' Check if any is NULL
MsgBox DTSSource("name")
MsgBox DTSSource("company")
MsgBox DTSSource("phone")

If DTSSource("name") = "" OR DTSSource("company") = ""
OR DTSSource("phone") = "" Then
Main = DTSTransformStat_SkipRow
Else
Main = DTSTransformStat_OK
End If
End Function

Data from sample.txt
'name','company','phone'
'employee1','electriccompany','28668989'
'employee2','electriccompany',
'employee3','company','28668989'



Need script for processing next row of data if error is encountered in row Paul Ibison
7/4/2003 4:16:18 AM
On the options Tab, increase the max error count
(detfaults to zero) and then on the same tab, add an
exception file. This file will contain the rows which
error. If you want a different file for sourse and
destination errors, you can use 2000 format.
HTH,
AddThis Social Bookmark Button