How can I delete All rows in SQL Server that were created later than 10 minutes. Thanks.
Assuming that you have a column name Date_column which is storing the timestamp. You may try like this, where mi is the abbreviation for minute:
DELETE FROM Table_name
WHERE Date_column < DATEADD(mi,-10,GETDATE())
SQL Server has no way to tell at what time the row was created. You will need to have an extra column in your table to log the time. If you do that, your delete statement becomes fairly straight forward.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With