Overview
This article provides the steps to be followed to configure the SQL Server Job Scheduler utility to execute a T-SQL script that clears all sessions every day at the specified time.
Information
Follow the steps below to schedule a T-SQL script to clear all server sessions every day at the specified time:
-
Expand the SQL Server Agent node and right-click the Jobs node in SQL Server Agent and select
'New Job'
-
In the
'New Job'
window enter the name of the job and a description on the'General'
tab. -
Select
'Steps'
on the left pane and click'New'
at the bottom. -
In the
'Steps'
window enter a step name and select the database you want the query to run against. -
Paste in the T-SQL command
"DELETE FROM EVEREST_SPM WHERE UID IN (SELECT UID FROM EVEREST_SPM WHERE ATTRIBUTE = 23 AND VALUE = 7)"
to run into the Command window and click'OK'
.Tip: The above T-SQL query can be customized to execute any appropriate script depending on the customer's requirements. -
Click on the
'Schedule'
menu on the left pane in the New Job window and enter the schedule information as desired (e.g. daily and time 3 AM EST). -
Click
'OK'
to schedule the job.
Below is an animated GIF of the above steps created using MSSQL Server 2012:
Comments
0 comments
Please sign in to leave a comment.