Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

TIMESTAMP(6) WITH TIME ZONE, space between seconds and timezone, need to remove it - response (3) by dnoeth

$
0
0

Dealing with "timestamp with time zone" is complicated and the rules how it's casted depend on some dbscontrol settings, too :-)
Plus there's a known limitation in ODBC, which doesn't support time zones, you always have to cast to string. 
 
You could play around with adding the difference of the time zones of EVENT_DTSZ and CURRENT_TIMESTAMP, but this gets ugly cause there might be hours and minutes.
I'd suggest casting to strings:
 

event_dtsz (FORMAT 'YYYY-MM-DDBHH:MI:SS.S(2)') (VARCHAR(22)) -- optional (TIMESTAMP(2))

event_dtsz (FORMAT 'Z') (VARCHAR(6)) -- optional (INTERVAL HOUR(2) TO MINUTE)

 

If this is only for display you don't need the optional cast, but you should use ANSI format YYYY-MM-DD instead of MM/DD/YYYY for correct sorting.

 

When you need this calculation in several places you might plug it into a SQL UDF In TD13.10.
 

 

Dieter


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>