Job.Drop Method

Include Protected Members
Include Inherited Members

Removes an existing job.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

Overload List

  Name Description
Public method Drop() Removes an existing job.
Public method Drop(Boolean) Removes an existing job.

Top

Examples

The following code example creates a job, then drops it.

C#

Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
jb.Create();
jb.Drop();

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "EFSD Job")
$jb.Create()
$jb.Drop()