Transform invalid dates -
07-10-2003
, 10:23 AM
I'm trying to run a DTS task that imports text files and
occasionally I'll get an error due to the source table
having invalid dates in what is supoosted to be a date
field. (i.e. the source data may have a string like
07/09/0003 instead of 07/09/2003).
I was trying to fix this by changing the transformation
from a direct copy to an ActiveX Script that first
evaluates the record for valid dates, and if valid, uses
that record. If not, uses another source field that I
know is valid date.
Maybe this should be posted on some type of VBscript group
but could anyone help me with me code?
Here is what I was trying to use:
Function Main()
'If the data in source column 005 is a valid date in
string format then import into AR-Date
If IsDate (DTSSource("Col005")) then
DTSDestination("AR_Date") = DTSSource("Col005")
'If the data is not a valid date then use the data from
column 16
Else
DTSDestination("AR_Date") = DTSSource("Col016")
End If
Main = DTSTransformStat_OK
End Function
THANKS IN ADVANCE!!! |