Hi, I am coding a DTS Local Package that transfers Access Data into SQL Data. I am pulling 2 fields: a month and a year. The month format is "Jan, Feb, Mar, Apr, May, Jun, etc.), the year format is "2007, 2008, 2009, etc". What I want to do is put these 2 fields together into one column in SQL in this format: "200701" instead of "2007Jan". Or for Feb: "200702".
Here is the code that I have, but I want to make it simpler and quicker:
Function Main()
if len(month(CDate(DTSSource("'year'") & "-" & DTSSource("'month'") & "-1"))) < 2 then
DTSDestination("demand_period") = DTSSource("'year'") & "0" & month(CDate(DTSSource("'year'") & "-" & DTSSource("'month'") & "-1"))
else
DTSDestination("demand_period") = DTSSource("'year'") & month(CDate(DTSSource("'year'") & "-" & DTSSource("'month'") & "-1"))
end if
Main = DTSTransformStat_OK
End Function
Is there a quick way to do this in VB coding? Thanks