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

How to Install SQL Server 2000

How To

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

To script alerts 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 Alerts, 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. Under SQL generation options, do one or more of the following:
    • Select the Replace alert if it exists check box to include in the script commands to delete any alerts with the same name as jobs generated by the script.

    • Select the Include notifications sent by alerts to the operator check box to include in the script commands to generate alert assignments for the operators generated by the script.

    • Select the Include the name of the job executed by the alert check box to include in the script commands to provide the name of the job executed by the alert.
  7. In the TSQL batch separator box, enter a Transact-SQL batch separator.

    Include the name of the job executed by the alert to have the alerts generated by the script reference their response jobs.