Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 16 May 2002 @ 18:05:34 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


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


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023