vertige
March 20th, 2003, 08:15 PM
Sorry for the newbe question but I can't seem to find the answer in any of the 8 t-sql books I bought.
I'm running ms sql 2000. I have a table called cart. Some of the items in the cart need to expire after a given amount of time. One of the fields is a datatime field called added. What i need to do is delete the record after 10 minutes.
I'm tring to user the job wizard to add a job that will run every 30 seconds. If the job finds an item in the cart that is older than 10 minutes it will delete it.
My imaginary query:
"Delete from cart where the difference between added and NOW is greater than 10 minutes"
I can do this programatically on the webserver end but it seems more logical and robust to do it using the sql server.
Any help would be greatly apreciated.
I'm running ms sql 2000. I have a table called cart. Some of the items in the cart need to expire after a given amount of time. One of the fields is a datatime field called added. What i need to do is delete the record after 10 minutes.
I'm tring to user the job wizard to add a job that will run every 30 seconds. If the job finds an item in the cart that is older than 10 minutes it will delete it.
My imaginary query:
"Delete from cart where the difference between added and NOW is greater than 10 minutes"
I can do this programatically on the webserver end but it seems more logical and robust to do it using the sql server.
Any help would be greatly apreciated.