Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    2

    Unanswered: Autoscript generator for SQL jOBS

    Background:
    SQL server 2000 and 2005

    I am trying to figure out or find a script that I would run every night to generate scripts for all the sql jobs, I do have scripts for scripting objects but I would appreciate any suggestions or sample scripts to get this accomplished.

    Regards

  2. #2
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    You can just BACKUP DATABASE msdb.

  3. #3
    Join Date
    Aug 2008
    Posts
    2

    Script

    Thanks for the suggestion

    Backing up MSDB is a daily schedule that we do here, what I am looking for is code to run everynight and generate script for all SQL Server 'jobs', so when I come the next day, I always have an upto date date file script for each server with all changes to jobs, or deletions to jobs... therefore, running the scripts would create a copy image of SQL jobs as they were at the time the script was created on any particular server with the corresponding script.

  4. #4
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    you could write a little C# console app that uses SMO to script the jobs.

  5. #5
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    If people are making changes on your system without saving the scripts then perhaps all you need are some better Configuration Management procedures. Or at least a source control system.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •