Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql delete function?

Status
Not open for further replies.

phatening

Programmer
Aug 8, 2005
18
0
0
US
Hey fellow programmers,

Quick question. For some reason I have this belief in my head that you can write a constraint(i believe) that will automatically delete expired records whenever a record expires. Supposedly the database will run the constraint everyday or routinely and the constraint will specify which records have expired by comparing the record's date field with the current date.

I tried googling for this but I can't find anything? Am i pulling this idea out of my ass? Or is it possible? I'm using a MySQL database by the way.

THANKS! =)
 
You could use a Trigger in your database (see but that would run on every Insert or Update. This may be too much database load.

You could also run a Stored Procedure from your front-end on a daily basis,

Note that both suggestions rely on version 5 functionality

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
You would probably get a more comprehensive answer to specific mySQL questions in the mySQL forum (forum436)

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
If I would approach this using a stored procedure in my front end, how would I run it on a daily basis?

How can I run a piece of code everytime my webapp has restarted and only once after each restart? I am using JSP's.

Thanks =).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top