17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating Jobs and Tasks Using Management Studio<br />

<strong>SQL</strong> <strong>Server</strong> Management Studio makes it very easy to create scheduled jobs. Just navigate to the <strong>SQL</strong><br />

<strong>Server</strong> Agent node of your server. Then right-click the Jobs member and select New Job. You should get<br />

a multimode dialog box, shown in Figure 19-3, that will help you build the job one step at a time:<br />

Figure 19-3<br />

Chapter 19: Playing Administrator<br />

The name can be whatever you like as long as it adheres to the <strong>SQL</strong> <strong>Server</strong> rules for naming as discussed<br />

early in the book.<br />

Most of the rest of the information is, again, self-explanatory with the exception of Category, which is just<br />

one way of grouping jobs. Many of your jobs that are specific to your application are going to be Uncategorized,<br />

although you will probably on occasion run into instances where you want to create Web Assistant,<br />

Database Maintenance, Full Text, or Replication jobs; those each go into their own category for easy<br />

identification.<br />

We can then move on to Steps, as shown in Figure 19-4. This is the place where we tell <strong>SQL</strong> <strong>Server</strong> to<br />

start creating our new tasks that will be part of this job.<br />

To add a new step to our job, we just click the New button and fill in the new dialog box, shown in<br />

Figure 19-5. We’ll use a T-<strong>SQL</strong> statement to raise a bogus error just so we can see that things are really<br />

happening when we schedule this job. Note, however, that there is an Open button to the left of the command<br />

box; you can use this to import <strong>SQL</strong> scripts that you have saved in files.<br />

567

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!