Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Tue, 21 Aug 2012 @ 12:13:16 GMT


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


Subj:   Re: How to replace with null if date is invalid
 
From:   McCall, Glenn David

Perhaps try reading the manual? You should also provide some details.

For example do you want to do this while loading the data from an external source?

Modifying the data already present in a table?

Conditionally changing the value when selecting it from a table without changing the underlying data?

I will assume you mean the last one - in which case I would suggest using the case statement.

     select  case
            when dt between '1950-01-01' and current_date + interval '5' year
     then dt
            else null
         end as dt
     from some_Table
     ;

How do you measure 5 years? Do you mean 5 years from today? Or 5 years from this year? (#1: dates <= '2017-08-21' #2: dates <= '2017' - up to and including dec 31.)



     
  <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: 28 Jun 2020