Delete Cart Items

Hi

I'm trying to best work out how to automate deleting cart items older than a certain number of days.

A bit of background:

Our organisation has hundreds of events a year.  Entries (registrations) close for these events approximately 6 weeks before the event takes place.  Currently members can go through the registration process, but not submit the order, and the item remains in their cart.  They can then go back during that 6 week period and finish the registration, thereby gaining entry to the event *after* entries have closed.

I have created an SQL query that will delete any cart items older than X hours (in this case, 48):

DELETE * FROM CartItem
WHERE DATEDIFF (hh, LastUpdated, CURRENT_timestamp) > '48'

I would like to have this automatically run once every 24 hours.  We have Task Centre for iMIS, at which I am a rank beginner, and I was hoping to be able to set up a task to automatically run this script, however I can't get the ODBC query to run the 'delete' query - works wonderfully if I replace DELETE with SELECT.

I'm not sure how best to do this - I thought maybe I could call on a stored procedure to run "delete" after selecting the records, but I don't know how to create a stored procedure ...

Any help or alternative suggestions appreciated!

Thanks

Shari