Invalid Timestamp Error

General
Enthusiast

Invalid Timestamp Error

Hi,

  I am trying to select a timestamp column in a defined format. Later on I will try and use that statement to update a timestamp column. I am using the following statement to check for the syntax but it is giving me an error of Invalid String. Please let me know what should be the correct syntax.

sel cast('02/28/2014 20:51:47.000000' as timestamp format 'MM/DD/YYYY HH:MI:SS.NNNNNN') from dummy_table

Regards,

Mithun

Tags (1)
2 REPLIES
Enthusiast

Re: Invalid Timestamp Error

There is nothing like DUMMY_table in Teradata. The below would give you the output. However the below format might not show up in SQL Assistant but you can see that when you are running in BTEQ

Either of the below works

sel cast( '02/28/2014 20:51:47.000000' as timestamp(6) format 'MM/DD/YYYYBHH:MI:SS.S(6)')

sel cast( '02/28/2014 20:51:47.000000' as timestamp(6) format 'MM/DD/YYYYBHH:MI:SS.DS(6)')

Enthusiast

Re: Invalid Timestamp Error

Thanks Krishaneeesh. It has resolved my problem. Dummy_table was just a note for reference.