Reputation: 17677
In SQL Management Studio, you can right click on an Agent Job and choose 'Script Job as' -> 'Create to/Drop to', which will reveal the backend code for the agent job.
Is there a script I can execute which would generate this code as well?
I've been searching for details on this, but all I can find so far is references for viewing the script via SQL Management Studio (Example 1, Example 2, Example 3).
If anyone could point me in the proper direction containing ANY details on how to query for a creation script, that would be awesome.
Upvotes: 1
Views: 2409
Reputation: 6771
Running a Profiler Trace while running the 'Script Job as' -> 'Create to' reveals a set of SQL statements that you could mimic:
Upvotes: 1