Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 25 Jun 2003 @ 21:55:01 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: String to Timestamp conversion
From:   Terry Stover

No easy way, you'll have to parse out the date and time components using substring & position, cast them to the correct format, concatenate them together and cast the result as timestamp(0). Here's a code snippet that merges separate date and time columns into a timestamp. Parsing the source string is left as an exercise for the student ;-). IMHO, you're better off fixing the format in the source system.

 cast(cast(cast(logdate as  format 'YYYY-MM-DD') as char(11)) || cast
(logtime as  format '99:99:99') as timestamp(0))

Terry Stover
Levi Strauss & Co.

  <Prev Next>   <<First <Prev
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016