CAST(1987-07-21T01:41:58.000Z) TO TIMESTAMP

Database

CAST(1987-07-21T01:41:58.000Z) TO TIMESTAMP

Hi Team,

Can some one help me with the below Sql. I know i have a way to achive this in Oracle, wondering if i can do that in Teradata.

I need to convert a Character field with data like '1987-07-21T01:41:58.000Z' to TIMESTAMP but i need the trailing character "z" also to be shown in the TIMESTAMP(6) Target column. Is that possible? If not, what is the significance of "z" (zone ?) how i can represent the same in Teradata ?

Thanks,

-- AsCharan

2 REPLIES

Re: CAST(1987-07-21T01:41:58.000Z) TO TIMESTAMP

Hi AsCharan,

I don't think, you can have character value in timestamp column, you should split in two columns, may be someone should have better idea.

Re: CAST(1987-07-21T01:41:58.000Z) TO TIMESTAMP

Hi.


 BTEQ -- Enter your SQL request or BTEQ command:

SELECT CAST('1987-07-21T01:41:58.000Z' AS TIMESTAMP(3) FORMAT 'YYYY-MM-DDbhh:mi:ss.s(3)b');

 *** Query completed. One row found. One column returned.

 *** Total elapsed time was 1 second.

'1987-07-21T01:41:58.000Z'

--------------------------

  1987-07-21 01:41:58.000

Cheers.

Carlos.