How to script jobs using Transact-SQL (Enterprise Manager)

How to Install SQL Server 2000

How To

How to script jobs using Transact-SQL (Enterprise Manager)

To script jobs using Transact-SQL

  1. Expand a server group, and then expand a server.

  2. Expand Management, and then expand SQL Server Agent.

  3. Right-click Jobs, point to All Tasks, and then click Generate SQL Script.

  4. In the File name box, type a name for the script.

  5. Under File format, do one of the following:
    • Click MS-DOS Text (OEM) to save the script in OEM format.

    • Click Windows Text (ANSI) to save the script in ANSI format.

    • Click International Text (Unicode) to save the script in Unicode format.
  6. Optionally, under SQL generation options, do one or both of the following:
    • Select the Replace job if it exists check box to include in the script commands to delete jobs that have the same names as the jobs generated by the script.

    • Select the Include target servers check box to include in the script commands to generate target server assignments. This option is available only when scripting multiserver jobs.
  7. In the TSQL batch separator box, enter a Transact-SQL batch separator.