DTS Transform of String Date to Datetime w/ milliseconds -
09-02-2004
, 02:31 PM
Hi -
I have a DTS job with a transform on a column written in Perlscript.
It basically splits the sections of a string formatted date
(HHMMSStttt) into variables and concatenates them into a string that
SQL can recognize as a datetime.
Everything works fine until I try to add in the milliseconds. My code
is below, but the string that I end up formatting to is of the format:
MM/DD/YYYY HH:MM:SS.tttt
If I try to manually key in a datetime of this format in EM, it gives
me an "Invalid Status for Bound Data" error (I read in another posting
that other people have had this issue in EM). I get the same error
through DTS. However, if I try to enter that field in via an INSERT
statement in QA, it takes it no problem (the ms don't display in EM
though, only through a SELECT in QA).
Any ideas on how to import this through a DTS transform?
Thanks
B
Code:
#************************************************* *********************
# Perl Transformation Script
#************************************************* ***********************
# Copy each source column to the destination column
sub Main()
{
my $hr=substr($DTSSource->Item("Col020")->{Value},0,2);
my $min=substr($DTSSource->Item("Col020")->{Value},2,2);
my $sec=substr($DTSSource->Item("Col020")->{Value},4,2);
my $msec=substr($DTSSource->Item("Col020")->{Value},6,3);
my $dt=$DTSGlobalVariables->Item("gv_yest_dt")->{Value};
$DTSDestination->Item("ExpRTime")->{Value} = $dt."
".$hr.":".$min.":".$sec.".".$msec;
return 1; # DTSTransformStat_OK;
} |