Page 1 of 1

Problem in converting String To TIME with micro seconds

Posted: Tue Apr 18, 2017 10:27 am
by jpraveen
Hi

I have a problem while i convert to string to Time.

my source is Flat file(fixed width) and need to load data into table(teradata)

The data for Time column from File is like

10:21:15
09:06:58
12:45:06

etc.,
I am generating some random numbers like 000001,123466,001523, etc.,

Now i need to append some random 6 digit numbers as micro seconds and try to load data into table ( column metadata as TIME(6) )

So , i have concatenated as 10:21:15 123456

But while the data is loaded the result in table as showing 10:21:15.000000

Is there any function like stringtotime(incol1,"%hh %mm %ss.s6") or esle anything..stringtotime(incol1,"%hh %mm %ss.s(6)")

I am sure there is no function like above

is i am missing the basics ?

Kindly suggest ..

Thank you

Posted: Tue Apr 18, 2017 11:23 am
by chulett
Shouldn't you be using a "dot" between them rather than a space? Also ensure you have enabled Microseconds in the extended properties for that column.

Posted: Tue Apr 18, 2017 9:50 pm
by jpraveen
Yes added 'dot' and Time(15,6)

Still the data is like '10:26:38.000000' in Table

Convserion :- StringToTime(InputCol,"%hh:%nn:%ss")

My input is '10:26:38.123456', but how to get micro seconds ?

Posted: Wed Apr 19, 2017 6:04 am
by chulett
Since you didn't mention it, what about the extended properties - was that something you were able to set?

Also note that, once that is set, your conversion should be StringToTime(InputCol,"%hh:%nn:%ss.6")