Skip to Main Content
Programming SQL Server 2005
book

Programming SQL Server 2005

by Bill Hamilton
February 2006
Intermediate to advanced content levelIntermediate to advanced
586 pages
17h 35m
English
O'Reilly Media, Inc.
Content preview from Programming SQL Server 2005

Chapter 16. SQL Server Agent

SQL Server Agent automates administrative tasks by running jobs, monitoring SQL Server, and processing alerts.

You can define jobs and their schedules, alerts, and operators by using Object Explorer in SQL Server Management Studio, by using T-SQL scripts, or by using SQL Server Management Objects (SMO). Using SMO is the focus of this chapter.

SQL Server Agent is disabled by default. Start SQL Server Agent by connecting to a server instance in Object Explorer. Right-click the SQL Server Agent node and click Start on the context menu to start SQL Server Agent.

Set SQL Server Agent to start automatically by launching SQL Server Configuration Manager from Microsoft SQL Server 2005 → Configuration Tools. Select SQL Server 2005 Services in the left panel, right-click SQL Server Agent from the list of services in the right panel, and select Properties from the context menu to launch the SQL Server Agent Properties dialog box. Select the Service tab and change the Start Mode to Automatic.

Programming SQL Server Agent

Figure 16-1 shows the key SMO SQL Server Agent classes and defines the relationships between them.

These classes are in the Microsoft.SqlServer.Management.Smo.Agent namespace.

The rest of this chapter presents programming examples that show how to use SMO SQL Server Agent classes and provides descriptions of the classes. You need a reference to the following assemblies to compile and run the examples:

  • Microsoft.SqlServer.ConnectionInfo

  • Microsoft.SqlServer.Smo ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Microsoft® SQL Server® 2012

Programming Microsoft® SQL Server® 2012

Leonard Lobel and Andrew Brust

Publisher Resources

ISBN: 0596004796Supplemental ContentErrata Page