dbTalk Databases Forums  

DTS Transform of String Date to Datetime w/ milliseconds

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


Discuss DTS Transform of String Date to Datetime w/ milliseconds in the microsoft.public.sqlserver.dts forum.



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

Default 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;
}

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.