Delete items older than a day - SQL Server
datetime, sql, sql-server
Solution
You can build a DELETE statement making use of the datediff and the getdate functions.
Usage example:
DELETE FROM yourTable WHERE DATEDIFF(day,getdate(),thatColumn) < -1
Problem
In a table in my datatase I have a datatime column which stores the time at which the record is added. How can I delete all records which are older than a day when I run a stored procedure (considering the current time) ?