- Create a job
Enterprise manager
--management
--SQL Server Agent
- Right-click job
- New homework
- Enter the job name in "General" item
- "Step" item
- New
- Enter the step name in "Step Name"
- Select "Transact-SQL Scripts (TSQL)" in "Type"
- "Database" Select the database that executes commands
- Enter the statement you want to perform in "Command":
DELETE FROM table Where Times <= dateadd (day, -1, getdate ())
--determine
- "Scheduling" item
- New dispatch
- Enter the schedule name in "Name"
- Select your job execution arrangement in "Scheduling Type"
- If you choose to "repeatedly appear"
- Click "Change" to set your schedule
Then start the SQL Agent service and set to automatically start, otherwise your job will not be executed.
Setting method:
My Computer - Control Panel - Administrative Tools - Services - Right-Right-Right-Right-Start Type - Select Auto Start - OK.