Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Convert the strings into Date Format - response (5) by WAQ

$
0
0
Well one workaround is that if you know that your date would be in specifc formats like YYYY/MM/DD, YYYY-MM-DD etc then u can use:   create volatile table te ( date_t varchar(12) ) on commit preserve rows; insert into te select '2012/11/24'; insert into te select '2012-11-24'; insert into te select '20121124'; select date_t ,case when position('/' in date_t) > 0 then cast(date_t as date format 'YYYY/MM/DD') when position('-' in date_t) > 0 then cast(date_t as date format 'YYYY-MM-DD') when position(' ' in date_t) = 0 then cast(date_t as date format 'YYYYMMDD') end from te;

Viewing all articles
Browse latest Browse all 27759

Trending Articles



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