Date Setting

Database

Date Setting

All,

we have new requirement regarding date setting.

eg:

I am loading data for Jan, Feb,mar. In April I have to delete jam data and my table should contain only 3 months data.

i have handled this by using below delete query

delete from table name where report_date<add_months((date-extract(day from date)),-3)

Now consider I have missed data load for May,Jun,July . In Aug when I run my load.....at the end it will delete previous 3 months data. My requi is though I missed my data load it should keep last 3 run data. So in Aug it should keep Feb n March data also. But above query is deleting all data and keeping only Aug data.

1 REPLY
Teradata Employee

Re: Date Setting

Do you keep a log table which has the dates for which you have ran your load for?