http://www.cnblogs.com/zerocc/p/3400529.html(转载)
use msdb
|
EXEC sp_add_job @job_name = 'tk_bakdata', |
@enabled = 1, |
@description = '每日00:30处理售票数据', |
@start_step_id = 1, |
@owner_login_name = 'sa' --须改成你的登录名 |
exec sp_add_jobserver @job_name = 'tk_bakdata' |
go |
EXEC sp_add_jobschedule @job_name = 'tk_bakdata', |
@name = 'Bakdata003000', |
@freq_type = 4, |
@freq_interval = 1, |
@active_start_time = 054500 --每日00:30 |
go |
EXEC sp_add_jobstep @job_name = 'tk_bakdata', |
@step_name = 'bakdata', |
@subsystem = 'TSQL', |
@command = 'delete from a ', --执行SQL |
@database_name='student' --数据库名 |