I’m using Microsoft SQL server, and I would like to know if it is possible to somehow add a row to a table which will delete itself after a while, unless “updated” or “pinged”.
I am programming a game from where I would like to have some kind of match-spectation system. If you go to http://ingamable.com, you should be able to see what I mean.
So every time I (from a game) start a match, the game sends a request to my webserver to create that match in the database. Now, while the match is running (every 10 minutes or so), I want the game to send yet another request, confirming that the game is in fact still open.
If no ping has been received, that match record is removed.
You can add a SQL Server agent Job that will check a date stamp of a row and delete it if it is “stale”.
This would require you to have a
DateUpdatedand/orDatePingedcolumn on the table which would be updated every time it is updated/pinged (whatever you mean by pinged).If you don’t have SQL Server agent available, one alternative is to use the task scheduler, possibly with sqlcmd.