0

Looking for a crazy script to run after database backup ...

Want to look at all agent jobs and if modified date is equal to today save it to a shared drive, if not skip. Also want to delete the oldest saved file if there are more than five. Any help on any step would be greatly appreciated!

  • 1
    Please post what you have so far, then someone can help to optimize. – SqlWorldWide Jan 9 at 14:55
  • 1
    Welcome to Database Administrators. Please, check the How do I ask a good question? instructions to avoid being downvoted. – Ronaldo Jan 9 at 15:24
0

A couple of suggestions:

  1. Don't ask us to write an entire system for you. It's probably ok if you have a particular problem with how some script operates, as long as it's DBMS related.

  2. Realize that all SQL Server Agent Jobs are stored in the msdb system database. In order to "save" jobs you could simply take a backup of the msdb database daily. You should do that anyway, since there is a lot of useful history, etc, stored in there.

  3. If you really need to "script" out the jobs, they're stored in msdb in the dbo.sysjobs and dbo.sysjobsteps tables.

|improve this answer|||||
  • Ok thank you. I will add the code ii have so far and rewrite the question – Kmadden1 Jan 10 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.