Archives of the TeradataForum
Message Posted: Wed, 22 Aug 2012 @ 19:16:39 GMT
Subj: | | Re: How to replace with null if date is invalid |
|
From: | | Kenneth Hansen |
Consider the proportion of the table on which you want to change the date. If significant then do not update but insert the correct values
into a new table and then drop the old table after testing.
I apologise for previously overlooking the impact of existing NULLS on processing "BETWEEN". Use a Case statement and start by identifying the
NULLS so that subsequent logic will work. Then the largest proportion next, the lowest proportion last.
Case < columnname >
when is null then null else
when < date '1950-01-01' then NULL else
when > (Current_Date plus interval 5 year then NULL else
< columnname > end
Being cautious - I would double check you have a copy saved before you test your code.
Good luck
Ken
|