Page 1 of 1

Conversion error

Posted: Thu Mar 23, 2006 9:28 pm
by Ratan Babu N
Hi,
In my Job, while I am converting from string (of length 10) to date and string (of length 10) to timestamp.
I gave the condition as -- If it is not a valid date then '0001-01-01' for date and '0001-01-01 00:00:00.000000' for timestamp. But eventhough the input record has a valid date it is giving the default values only in the output.

and the warning i got in the director is as follows

Trns_Validate,0: Conversion error calling conversion routine date_from_string data may have been lost

Plz help me out in this issue.

Posted: Thu Mar 23, 2006 9:35 pm
by rasi
Ratan

Look the format of the string in the source and check whether you are using the same format to check whether it is valid or not?. How are verifying whether the string is valid date or not?... Give some examples and your conversion logic we might be able to help you

Thanks

Posted: Thu Mar 23, 2006 9:59 pm
by Ratan Babu N
Hi Siva,
Thank you very much, I gave a different format thats why i didnot get initially.
one more query is : the input field is a string '12-23-2005' can we convert it into timestamp directly. I tried with stringtotimestamp function.but i got the message as

Trns_Validate,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%mm-%dd-%yyyy" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid Format [%mm-%dd-%yyyy] used for string_from_time type conversion.

Posted: Thu Mar 23, 2006 10:25 pm
by rasi
Ratan
the input field is a string '12-23-2005' can we convert it into timestamp directly

Your string only has date part and not time part. What you need to do is concat date and time part together and then convert it into timestamp. If you don't have time part then have default values

Thanks

Posted: Thu Mar 23, 2006 10:52 pm
by kumar_s
You can use TimestampFromDateTime(). You can give the datea as one input and hardcoded default time as other.