Creating a Task

    To create a task
  1. From the Server Manager window, select a server, and then from the toolbar, choose the Task Scheduling button.

    The Task Scheduling window appears.

  2. Choose the New Task button.

    The New Task dialog box appears.

  3. Complete the Task and Schedule information in this dialog box.

    For details about the Task and Schedule information managed in this dialog box, see the definitions that follow this procedure. For information about scheduling a task, Scheduling Task Execution.

  4. To set options for the new task, choose Options and complete the Task Options dialog box that appears.

    You can set options for email notification, Windows NT Event log messages, and retry attempts. For more information, see Setting Task Options.

  5. Choose Add.

    The task is created.

Following are brief descriptions of the selections you will make and the information you will provide when creating (or modifying) a task.

Name
A unique name for the task.
Enabled
If this box is selected, the task is created and scheduled. If this box is cleared, the task is created but not scheduled.
Database
The database the task will be executed against.
Type
The type of task to be scheduled. Most often you will select CmdExec or TSQL. The other types are used for replication scheduling. There are five task types:
CmdExec
An operating system command, or a .CMD or .EXE file as specified in the Command box.
Distribution
A replication distribution process command.
LogReader
A replication logreader process command.
Sync
A replication synchronization process command.
TSQL
A Transact-SQL statement to be run against the selected database. The statement is limited to 255 characters and cannot contained embedded "go" commands.
Command
The text of the task to be scheduled. This can be a valid operating system command, the filename (including path) of an .EXE file, or a Transact-SQL statement.

This can also be a command to one of the replication processes. For information about replication-related commands, see Replication Task Scheduling.

Schedule
Used to schedule the task.
On Demand
The task is created but is not scheduled. On demand tasks are the only type of tasks that can be used by alerts. When the alert occurs, the task is run.

On-demand tasks can also be run from the Task Scheduling window by using the Run Task button.

One-Time
The task occurs once, at the specified date and time. After running, it will be disabled but not deleted.
When
If One Time is selected, the When date and time boxes set the schedule for the one-time execution of the task.
Recurring
Specify a recurring schedule for the task. The schedule is displayed in the box below Recurring. The default for a recurring task is once a week on Sunday. Choose Change to change the schedule.
Change
Allows you to change the schedule of a task. Opens the Task Schedule dialog box. For information about this dialog box, Scheduling Task Execution.
Auto Start
SQL Server automatically starts the task when SQLExecutive starts. Used by replication processes.
Add
Adds the task you have specified.
Options
Allows you to specify options about email and Windows NT Event log notification and retry attempts for a particular task.