Hi everyone,

I have made a script which logs the users ip into a table.
Here is the table:


What I would like to happen is that after a row has been inserted, I want to set up a sql JOB, to automatically tjeck this table for rows which are >= 24 hours old, and if found, then delete the row.

Or if it is easier to create: If time is 00.00 then delete all records in the table, that could support my idea too :-)

It is for a voting system on a website.

The only thing is, that I have never been near creating a JOB in SQL, I have just stuck to SELECT, UPDATE, DELETE statements.

It is the very last thing I need for finishing my exam project, and I hope someone can be helpful.

Regards Klemme

Recommended Answers

All 2 Replies

If you want to do this after an insert, see the manual on TRIGGERS, otherwise see EVENTS.

Thanks pritaeas I will look into your links posted :-)

It not not after an insert, no user-action should be required for the deletion to happen.

So I suppose it should be an event, scheduled to run everyday at i.e. 00.00.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.