dbTalk Databases Forums  

Transform invalid dates

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


Discuss Transform invalid dates in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
graham
 
Posts: n/a

Default 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!!!


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.