I was writing a query to delete any row which has a post date over 5 days ago. The postDate format is date('Y-m-d H:i:s').
When debugging I just tried deleting all rows in the table which worked and deleted the entire table every 10 seconds. But when adding the rest of the statement it seems like not working when I use the "getdate()" function.
I made it recur every 10 seconds and compare it to a future date for testing reasons.
ON SCHEDULE
EVERY 10 SECOND
ON COMPLETION NOT PRESERVE ENABLE
DO
DELETE FROM posts WHERE postDate < DATEADD(dd,1,GETDATE())
No records in the table are deleted even if I make it
DELETE FROM posts WHERE postDate != DATEADD(dd,1,GETDATE())
Records only deleted when the statement is:
DELETE FROM posts
Aucun commentaire:
Enregistrer un commentaire