Created
February 18, 2021 15:17
-
-
Save pfrozi/913fa70b396650c1aacb457b3a96a982 to your computer and use it in GitHub Desktop.
Create a new job on SQLServer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC dbo.sp_add_job | |
@job_name = N'NameOfJob' ; | |
GO | |
EXEC sp_add_jobstep | |
@job_name = N'NameOfJob', | |
@step_name = N'Description of job step.', | |
@subsystem = N'TSQL', | |
@command = N'EXEC SP_MYJOB ''A'',''B'',''C'' ', | |
@retry_attempts = 5, | |
@retry_interval = 5 ; | |
GO | |
EXEC dbo.sp_add_schedule | |
@schedule_name = N'JobSchedule', | |
@freq_type = 4, | |
@active_start_time = 030000, | |
@freq_interval = 1; | |
GO | |
EXEC sp_attach_schedule | |
@job_name = N'NameOfJob', | |
@schedule_name = N'JobSchedule'; | |
GO | |
EXEC dbo.sp_add_jobserver | |
@job_name = N'NameOfJob'; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment