Converting CHAR to DATE

Database
ASR
Fan

Converting CHAR to DATE

Hello,

I'm very much new to Teradata and writting queries as such. I have a CHAR Type column which contains data as follows

'2012-01-20 02:32:37.000000'.

How do I convert this CHAR type data to DATE Type, preferably as a timestamp?

Regards,

ASR

4 REPLIES
Enthusiast

Re: Converting CHAR to DATE

Cast('2012-01-20 02:32:37.000000' as Timestamp(6));

Regards...

ASR
Fan

Re: Converting CHAR to DATE

Thanks a lot Alvie.

Enthusiast

Re: Converting CHAR to DATE

What does the (6) in the parenthesis indicate?

Enthusiast

Re: Converting CHAR to DATE

The TIME and TIMESTAMP data types have a number (from 0 to 6) of fractional seconds in the seconds field which can be specified or defaults to 6 .