Generating script for existing sql jobs

  • we have a database and we are planning to deploy the database on another Box. I have database tables,stored procedures,views,user defined functions,triggers and some jobs on this database. So instead of restoring a back of this database we are planning to create the whole environment by using the sql scrtipts. So I know how to generate the sql script for all the objects(using generate sql script at database level) but how can I get the script for my Sql Jobs. How can I copy all the sql jobs onto the the new Box.
     
    Thanks.
  • Select the job(s) you want from Management-SQL Agent-Jobs  in enterprise manager

    Right click and choose all tasks->Generate script

  • One GOTCHA with the above approach:

    If any jobs have T-SQL steps, and any of these steps contain the `GO' Batch separator, the script will not work on the target server without a little tweeking.  This is because the Query Analyzer won't know if the GO is part of the job step, or part of the job step creation script.

    To fix this, specify an alternate batch separator when you generate the script.  Then tell QA to use the same batch separator when you run it.

    jg

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply