dbTalk Databases Forums  

Package to Continue On Error

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Package to Continue On Error in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
J O Holloway
 
Posts: n/a

Default Package to Continue On Error - 07-08-2003 , 02:58 PM






I have a simple DTS package that moves data from a flat file to a table. It
does very little scrubbing.
Here is the ActiveX code:

Function Main()
DTSDestination("ColA") = DTSSource("Col002")
DTSDestination("ColB") = left(DTSSource("Col003"), 4) &"-" &
right(DTSSource("Col003"), 2)
DTSDestination("ColC") = DTSSource("Col004")
DTSDestination("ColD") = DTSSource("Col005")

Main = DTSTransformStat_OK
End Function

Occasionally the datum in DTSSource("Col003") will be invalid for its
intended destination column. What I want is if an error occurs (due to an
invalid piece of data) for the package to just skip over that row. How do I
accomplish this? TIA



Reply With Quote
  #2  
Old   
J O Holloway
 
Posts: n/a

Default Re: Package to Continue On Error - 07-08-2003 , 04:17 PM






What I did for now was to wrap it this way:

Function Main()

if isNumeric(DTSSource("Col002")) then
DTSDestination("ColA") = DTSSource("Col002")
DTSDestination("ColB") = left(DTSSource("Col003"), 4)
DTSDestination("ColC") = DTSSource("Col004")
DTSDestination("ColD") = DTSSource("Col005")
Main = DTSTransformStat_OK
else
Main = DTSTransformStat_SkipRow
end if

End Function

This stops the bad rows from coming in. However, what I would like is to
handle the error in the script, like a try..except in Delphi. Any help
would be much appreciated.


"J O Holloway" <jholloway (AT) pinncorp (DOT) com> wrote

Quote:
I have a simple DTS package that moves data from a flat file to a table.
It
does very little scrubbing.
Here is the ActiveX code:

Function Main()
DTSDestination("ColA") = DTSSource("Col002")
DTSDestination("ColB") = left(DTSSource("Col003"), 4) &"-" &
right(DTSSource("Col003"), 2)
DTSDestination("ColC") = DTSSource("Col004")
DTSDestination("ColD") = DTSSource("Col005")

Main = DTSTransformStat_OK
End Function

Occasionally the datum in DTSSource("Col003") will be invalid for its
intended destination column. What I want is if an error occurs (due to an
invalid piece of data) for the package to just skip over that row. How do
I
accomplish this? TIA





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.