6fingeredman
Programmer
Hi,
My Source table contains a varhcar(20) field which holds dates in the format YYYY-MM-DD, I am trying to convert the dates but am having problems. Ive attached 2 examples of how I have been trying. Please could someone give me some tips on where I am going wrong? I get the following error :'Type mismatch on CDATE' with both scripts
and : '
----------------------
Dim strDate
Dim dDate
Function Main()
strDate = DTSSource("clindate")
dDate = cDate(Mid(strDate, 9, 2) + "/" + Mid(strDate, 6, 2) + "/" + Left(strDate, 4) )
DTSDestination("Clinic_Date") = dDate
Main = DTSTransformStat_OK
End Function
--------------------------------------------
Dim dDate
Dim iDay
dim imonth
dim iyear
Function Main()
iday = cint(mid(DTSSource("clindate"),9,2))
imonth = cint(mid(DTSSource("clindate"),6,2))
iyear = cint(left(DTSSource("clindate"),4))
DTSDestination("Clinic_Date") = DateSerial (iyear, imonth, iday)
Main = DTSTransformStat_OK
End Function
My Source table contains a varhcar(20) field which holds dates in the format YYYY-MM-DD, I am trying to convert the dates but am having problems. Ive attached 2 examples of how I have been trying. Please could someone give me some tips on where I am going wrong? I get the following error :'Type mismatch on CDATE' with both scripts
and : '
----------------------
Dim strDate
Dim dDate
Function Main()
strDate = DTSSource("clindate")
dDate = cDate(Mid(strDate, 9, 2) + "/" + Mid(strDate, 6, 2) + "/" + Left(strDate, 4) )
DTSDestination("Clinic_Date") = dDate
Main = DTSTransformStat_OK
End Function
--------------------------------------------
Dim dDate
Dim iDay
dim imonth
dim iyear
Function Main()
iday = cint(mid(DTSSource("clindate"),9,2))
imonth = cint(mid(DTSSource("clindate"),6,2))
iyear = cint(left(DTSSource("clindate"),4))
DTSDestination("Clinic_Date") = DateSerial (iyear, imonth, iday)
Main = DTSTransformStat_OK
End Function