February 26, 2016 at 8:26 am
I'm curious to know if a SQL Agent job can have a job step that will delete that very job, effectively making itself go away. One-time use scenario. Or is there an easier way to run as SSIS package just once? Don't want that package hanging around in job form...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
February 26, 2016 at 8:48 am
Yes... you can make a "self-deleting" job. When you're setting up, look under "Notifications" for the "Automatically Delete Job" check box.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 26, 2016 at 8:56 am
sgmunson (2/26/2016)
Or is there an easier way to run as SSIS package just once? Don't want that package hanging around in job form...
From what context are you trying to start the Package, Stored Proc, Agent Job, other?
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
February 26, 2016 at 9:22 am
In a previous job, I inherited an environment where a developer did that as part of an automated process. Made it more difficult to track down and troubleshoot than necessary.
I would suggest running it via t-sql, dtexec, SSMS or visual studio if it's a one time thing.
February 26, 2016 at 9:29 am
I don't mind one time jobs, but don't have them delete right away. I want the history and being able to look in the short term.
We had a few one time jobs, we'd just disable, because we could use them later (weeks/months) to run a different process, and we'd change the job then and set for one time. I also ran into someone that had jobs scheduled for one occurrence (do this tonight), and they'd have a separate job that deleted any one time jobs that had completed over a week ago.
February 28, 2016 at 10:11 pm
Thanks for the responses everyone. I did not know about the option within the Notifications tab, which is interesting. I had not yet had a chance to run my self-deleting job at the point I made the post, and it turns out it ran sooner than expected, and it did indeed delete itself. I simply had the last step execute sp_delete_job. It looks cleaner to have it done via the notifications tab, so that's probably how I'll set it up. We just can't afford to have the things this job does run more than once, and don't want the job hanging around any longer than absolutely necessary.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply