question

aRookieBIdev avatar image
aRookieBIdev asked

SQL Agent Job Creation

Hi , I would like to create a SQL Agent Job which should run every one hour after the Job is being triggered. The Job will be triggered manually in SQL Server Agent and should run every one hour from the time it is triggered. I would also script out this job creation script. Kindly let me know your thoughts. Thanks Kanna
sql-server-2012jobsagentsql server agent
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JohnM avatar image
JohnM answered
You can do this by using sp_update_jobschedule. Make the first step a TSQL step that will adjust the corresponding job schedule to execute at the appropriate time. Given that the job will be launched manually, you'll also have to enable the schedule so that it'll run automatically once it's initially launched. Reference: https://technet.microsoft.com/en-us/library/ms178560(v=sql.110).aspx I would build out the job & schedule within the UI and then script it out. Hope that helps!
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aRookieBIdev avatar image aRookieBIdev commented ·
Exactly what i was looking for .. Thanks
1 Like 1 ·
JohnM avatar image JohnM commented ·
Very welcome!! Glad it helped!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.