Scripting Jobs and Alerts


Alerts and jobs can be quite complex and time consuming to set up and debug. Regular backups of the MSDB database ”where the definitions for alerts and jobs are stored ”will protect you against loss of these objects; however, it is also a good idea to script at least your most complex jobs. Scripting is also a good way to store versions of a job as it is modified. If the modification doesn't have the desired behavior, the script can be run to restore the previous version. Another use for scripts is to easily transfer jobs or alerts to another server. To generate a script for a job or alert, right-click it and select Generate SQL Script. Provide a name for the file and select the text format and whether the script should generate DROP commands (replace) for the object. A Preview button is also available so you can view the script, as shown in Figure 18.15.

Figure 18.15. Previewing SQL script generation.

graphics/18fig15.jpg



Microsoft SQL Server 2000 Unleashed
Microsoft SQL Server 2000 Unleashed (2nd Edition)
ISBN: 0672324679
EAN: 2147483647
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net