|
|
Archives of the TeradataForum
Message Posted: Thu, 16 May 2002 @ 18:05:34 GMT
Subj: | | Re: Testing for valid dates |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Thursday, May 16, 2002 13:56 -->
One way is to do a join to sys_calendar.calendar
-- table holding test data
CREATE SET TABLE TEST1.datenums ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL
(
c VARCHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC)
PRIMARY INDEX ( c );
-- sample data
select * from datenums;
c
----------
20020101
20025050
-- sample query to get valid dates out, with the rest becoming null
select b.calendar_date
from datenums A
left outer join sys_calendar.calendar b
on cast(b.calendar_date as varchar(10)) = cast(a.c as decimal(10));
calendar_date
-------------
?
2002-01-01
| |