USE msdb ;
GO
EXEC dbo.sp_add_job
@job_name = N'Daily Reset of LogIn User Data';
GO
EXEC sp_add_jobstep
@command = N'UPDATE COMMAND',
@retry_attempts = 5,
@retry_interval = 5 ;
GO
EXEC dbo.sp_add_schedule
@schedule_name = N'RunDaily',
@freq_type = 4,
@active_start_time = 000000 ;
USE msdb ;
GO
EXEC sp_attach_schedule
@job_name = N'Daily Reset of LogIn User Data',
@schedule_name = N'RunDaily';
GO
EXEC dbo.sp_add_jobserver
@job_name = N'Daily Reset of LogIn User Data';
GO
我无法弄清楚如何在@command
;中插入 Update 命令。
我的命令是
UPDATE MyUserTable SET IsActive='N' WHERE IsActive='Y'