CAST and TRYCAST producing different results

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Teradata Employee

CAST and TRYCAST producing different results

Hi,

 

I am using CAST and TRYCAST on a VARCHAR field and casting it into TIMESTAMP WITH TIME ZONE. Both funtions are producing differnent time zones.

SELECT 

Type(COL) AS DATATYPE

 ,CAST(COL AS TIMESTAMP) AS WITHCAST_WO_TZ
,TRYCAST(COL AS TIMESTAMP) AS WITHTRYCAST_WO_TZ

,CAST(COL AS TIMESTAMP WITH TIME ZONE) AS WITHCAST_W_TZ
,TRYCAST(COL AS TIMESTAMP WITH TIME ZONE) AS WITHTRYCAST_W_TZ

FROM DB.TBL 
WHERE ID=123123123 order by start_date; 

Below is result

timstamp1.PNG

Teradata time zone is 

timstamp2.PNG

 

Has anyone faced something similar?

1 REPLY
Teradata Employee

Re: CAST and TRYCAST producing different results

I would suggest you report this to Teradata support as a bug. 

 

It looks like CAST correctly identifies that a Daylight Saving adjustment is in effect for your current session, but would not have been in effect on 16 Aug 2017; while TRYCAST seems to use the current session time zone as-is.