Is it possible to dynamically remove data from a table?
I'd like to know if it is possible to be able to remove dormant data from a table dynamically? I have a table in my database which is for reserved tickets that are on sale on a site, but they will only be needed in there for about 10 minutes (which is the reserve time before they go back on sale) and I'd like to be able to get those entries deleted as they would no longer be needed and would just take up space in the table.
The time will be logged in the table using the NOW() command plus 10 minutes, so I'm assuming that there is a way to query the database to check for expired times and then delete them?
If anyone knows of how and if this is possible, I would be grateful for any help.
SELECT * FROM Table WHERE your_date_field <= NOW()
If you are using MSSQL Server...
SELECT * FROM Table WHERE your_date_field <= '" & NOW() & "'
That's for ASP if I'm not mistaken. Fr MSSQL it should be
Originally Posted by yamaharuss
SELECT * FROM Table WHERE your_date_field <= GETDATE()
I was assuming the query was running from a web page. If so, and using MSSQL, the date field required single quotes.
Thanks for your help The NOW() did the trick.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread