When DTS hits a bad date

Giganews Newsgroups
Subject: When DTS hits a bad date
Posted by:  robboll (robbo…@hotmail.com)
Date: 24 Aug 2006

This routine works in most cases, but fails when a bad date is entered
such as:
19910631 -- there is no June 31st.

Instead of ignoring the bad date the entire DTS job fails.  Obviously
this is something that should be validated at data entry, but
unfortunately the only control I have is when appending to the table
with these data quirks. Any suggestions appreciated!!!

'**********************************************************************

'  Visual Basic Transformation Script
'  Copy each source column to the
'  destination column
'************************************************************************

Function Main()
        'DTSDestination("Col002") = DTSSource("Col002")
        if DTSSource("Col002") = "99999999" or DTSSource("Col002") =
Null then

                        Main = DTSTransforStat_SkipRow
                else
        DTSDestination("Col002") =  mid(DTSSource("Col002"),1,4) & "/"
&
mid(DTSSource("Col002"),5,2) & "/" & mid(DTSSource("Col002"),7,2)
              End if
        Main = DTSTransformStat_OK
End Function

RBollinger

Replies