Mysql delete records older than
DELETE FROM news WHERE INTERVAL 14 DAY) Above is the code that I would use to do that job. Hope this helps. Angela Thomas Katsampes wrote: Hello, I'm trying to figure out the correct syntax for requesting the database to remove all records older than 14 days.Delete records older than N days, hours or minutes in SQL Server. To delete records from a table that have a datetime value in Datecolumn older than 30 days use this query: USE Databasename; DELETE FROM Tablename WHERE Datecolumn. GETDATE() 30 mysql delete records older than
In MSSQL, you could create a job to run daily which deletes the first 1000 rows of your query. To steal Adam's query DELETE TOP 1000 FROM Table WHERE DATEADD(year, 2, CreateDate) getdate() This would be very safe and would get rid of your data in three months or so safely and would them also maintain the size of the db in the future.