SQL Server help Please

Soldato
Joined
18 Oct 2002
Posts
4,923
Not sure on the naming but for some reason I think its called a Cron Job or somthing similar.

What i've got is a table that contains sessionKeys that have a 2 hour expire time on them. I'm after somthing that I can set to run say every 4 hours that will run through the table and remove all the sessionKeys that have expired.

any ideas ?
 
therubble said:
Just setup a sceduled task that deletes from the table using datediff in the where clause, if the table is large use a table variable of something to loop around to prevent locking for any *** period of time.


and how do I setup these scheduled tasks from what I can find out I think you mean setting up a scheduled task in windows to do it ?

if so this is not an option i dont have access to the windows machine running sql server. , any way I can set something up in enterprise manager ?
 
Last edited:
umm the On_Update sounds the way to go, will have a look into this and see what I can find.

failing that I can just mention about the schedule task as its a uni assignment.



thanks again mate
 
therubble said:
SQL server has a mechanism inside of it for this very task. Look under management > Sql Server Agent > Jobs

Setup a new Job that executes your SQL on the schedule that it set's dont go the trigger route.

Can't find that here on studio Menagement Studio, under management theres only SQL Server Logs, Legacy and activity monitor. non of them let me add a server agent.

Will check enterprise manager in a bit as i'm going into uni today.
 
Back
Top Bottom