Monday, March 19, 2012

Deleting a record older then 10 minutes

Hey Guys,
I have been trying to work out how I would delete a record that was created more then 10 minutes ago.
I can use this to delete records older then a day.
DELETE FROM DownloadQueue WHERE Downloading = '0' AND QueuePos = '0' AND DateTime < GETDATE() - 1
Just need something now that will do it for just 10 minutes.
Cheers.You could use this:
DELETE FROM DownloadQueue
WHERE Downloading = '0' AND QueuePos = '0' AND DateTime < DATEADD(mi,-10,GETDATE())

No comments:

Post a Comment