I've created a mysql table to hold some records (id, timestamp, fname..etc). The main goal is to hold this info for 1 year and then archive it. I have no experience with triggers but I'm wondering is it possible to use the timestamp in a trigger so that a year from the timestamp it gets moved to an archive table?
Asked
Active
Viewed 204 times
0
-
share if you have written something. We can not write complete trigger for you!! – Suresh Kamrushi Nov 08 '13 at 13:51
-
Instead of using a trigger (what, if nothing happens to start the trigger? you should think about using a daily or weekly job (this can be started by the operating system). – nabuchodonossor Nov 08 '13 at 13:51
1 Answers
0
As per the documentation:
A trigger is defined to activate when a statement inserts, updates, or deletes rows in the associated table. These row operations are trigger events.
Time passed isn't one of those trigger events.
You have to create a process to do that job for you.
See this answer for some approaches to do that.

Community
- 1
- 1

Filipe Silva
- 21,189
- 5
- 53
- 68