All Forums Database
yiannish 13 posts Joined 06/14
24 Nov 2014
Delete old records from a table after a period of time

The problem:
I have a log table that will have a large number of individual inserts or rows each day(about 500).
I want to find a way to be able to delete all the lines that are for example more than 10 days old.
 
I believe this can be done with triggers. I have searched a lot but couldn't find an implmentation on teradata syntax.
 
The closest excample I found is this but it does not work in teradata.
http://stackoverflow.com/questions/21235706/create- trigger-for-sqlite-when-new-record-is-inserted-to- delete-old-records
 
Feel free to suggest other solutions, if any

dnoeth 4628 posts Joined 11/04
26 Nov 2014

Of course you can use a trigger (but change the syntax from sqllite to Teradata), but why trigger a delete whenever there's a new row inserted?
Better run a daily batch job to delete the outdated rows.

Dieter

You must sign in to leave a comment.