Results 1 to 3 of 3

Thread: Automate scripting SQL jobs

  1. #1
    Join Date
    Mar 2007
    Posts
    27

    Automate scripting SQL jobs

    Hi
    I need to be able to script all my sql jobs into a text file from command prompt.
    I can script out all the jobs with SSMS but I need to automate this process.
    what do you think is the best way to achive this?
    by the way platform is sql server 2005 SP2
    Thanks

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Use profiler to find out what sql does when you script jobs in ssms, then put them in script and run the script in sqlcmd.exe.

  3. #3
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    You could write SQL-SMO to generate SQl Agent JOb scripts.

    I wrote this for 2000
    http://www.databasejournal.com/featu...le.php/3401081


    For 2005, you could use SMO and powershell. Some examples
    http://www.databasejournal.com/featu...le.php/3705236

    This will give you are high level idea for creating such automated script.

Posting Permissions

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