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;
↧