February 11, 2012 at 3:12 pm
Comments posted to this topic are about the item Self Deleting Job
February 13, 2012 at 6:39 am
You could also use the @delete_level parameter of sp_add_job.
0 = Never
1 = On success
2 = On failure
3 = Always
When using SSMS to create/modify the properties of a job this appears on the Notifications page "Automatically delete job:" with a dropdown to choose when the job will be deleted.
February 13, 2012 at 9:29 am
Wow.. some simple, and somehow I missed that.
Thank you for your input. This shows you that there are many ways to skin a cat, and some of us choose the most convoluted way.
:w00t:
February 13, 2012 at 10:28 am
You're welcome Miguel. This won’t be the first (or last) time any of us find ourselves in this situation. The reason I knew about the delete level is from working on a system that created and ran many jobs throughout the day, some as often as every five minutes. Setting the delete level to delete the jobs upon success allowed the system to keep itself cleaned up. Any jobs that failed would stick around and the job output could then be used to investigate why they failed.
May 11, 2016 at 7:08 am
Thanks for the script.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply