Job Class

 

The Job class represents a Microsoft SQL Server Agent job.

Namespace:   Microsoft.SqlServer.Management.Smo.Agent
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)


public sealed class Job : AgentObjectBase, IAlterable, ICreatable, 
	IDroppable, IDropIfExists, IRenamable, IScriptable

NameDescription
System_CAPS_pubmethodJob()

Initializes a new instance of the Job class.

System_CAPS_pubmethodJob(JobServer, String)

Initializes a new instance of the Job class on the specified instance of Microsoft SQL Server Agent and with the specified name.

System_CAPS_pubmethodJob(JobServer, String, Int32)

Initializes a new instance of the Job class on the specified instance of SQL Server Agent and with the specified name and category

NameDescription
System_CAPS_pubpropertyCategory

Gets or sets the category to which the job belongs.

System_CAPS_pubpropertyCategoryID

Gets the ID value that uniquely identifies the job category.

System_CAPS_pubpropertyCategoryType

Gets or sets the type of category, with respect to local or multiserver jobs.

System_CAPS_pubpropertyCurrentRunRetryAttempt

Gets the number of times Microsoft SQL Server Agent has attempted to run the job unsuccessfully.

System_CAPS_pubpropertyCurrentRunStatus

Gets the current execution status of the job.

System_CAPS_pubpropertyCurrentRunStep

Gets information about the job step that is currently running.

System_CAPS_pubpropertyDateCreated

Gets the date and time when the job was created.

System_CAPS_pubpropertyDateLastModified

Gets the date and time when the job was last modified.

System_CAPS_pubpropertyDeleteLevel

Gets or sets the completion action that determines whether to delete the job definition when the job finishes execution.

System_CAPS_pubpropertyDescription

Gets or sets the textual description of the job.

System_CAPS_pubpropertyEmailLevel

Gets or sets the completion action that determines whether to send an e-mail notification to an operator when the job finishes execution.

System_CAPS_pubpropertyEventLogLevel

Gets or sets the completion action that determines whether to generate an operating system event log entry when the job finishes execution.

System_CAPS_pubpropertyExecutionManager

Gets the object to execute to the manager.(Inherited from SqlSmoObject.)

System_CAPS_pubpropertyHasSchedule

Gets the Boolean property value that specifies whether the job has at least one schedule.

System_CAPS_pubpropertyHasServer

Gets the Boolean property value that specifies whether the job has a target server assigned for multiple-server operations.

System_CAPS_pubpropertyHasStep

Gets the Boolean property value that specifies whether the job has at least one job step.

System_CAPS_pubpropertyIsEnabled

Gets or sets the Boolean property value that specifies whether the job is enabled.

System_CAPS_pubpropertyJobID

Gets the job ID value.

System_CAPS_pubpropertyJobSchedules

Gets a collection of JobSchedule objects that represent the schedules assigned to the job.

System_CAPS_pubpropertyJobSteps

Gets a collection of JobStep objects that represent the job steps defined for the job.

System_CAPS_pubpropertyJobType

Gets the job type, which specifies whether the job is local or multiserver.

System_CAPS_pubpropertyLastRunDate

Gets the date and time when the job was last run.

System_CAPS_pubpropertyLastRunOutcome

Gets the result of the job from the last time it completed execution.

System_CAPS_pubpropertyName

Gets or sets the name of the Job.(Overrides NamedSmoObject.Name.)

System_CAPS_pubpropertyNetSendLevel

Gets or sets the completion action that determines whether to net-send a notification to an operator when the job finishes execution.

System_CAPS_pubpropertyNextRunDate

Gets the date and time when the job is next scheduled to run.

System_CAPS_pubpropertyNextRunScheduleID

Gets the ID value of the schedule that is responsible for the next execution of the job.

System_CAPS_pubpropertyOperatorToEmail

Gets or sets the operator that receives notification by e-mail when the job finishes execution.

System_CAPS_pubpropertyOperatorToNetSend

Gets or sets the operator that receives a net-send notification when the job finishes execution.

System_CAPS_pubpropertyOperatorToPage

Gets or sets the operator that receives a pager notification when the job finishes execution.

System_CAPS_pubpropertyOriginatingServer

Gets the name of the server that is acting as the master server in a multiserver job.

System_CAPS_pubpropertyOwnerLoginName

Gets or sets the owner of the job.

System_CAPS_pubpropertyPageLevel

Gets or sets the completion action that determines whether to send a pager notification to an operator when the job finishes execution.

System_CAPS_pubpropertyParent

Gets or sets the JobServer object that is the parent of the Job object.

System_CAPS_pubpropertyProperties

Gets a collection of Property objects that represent the object properties.(Inherited from SqlSmoObject.)

System_CAPS_pubpropertyStartStepID

Gets or sets the ID value of the first job step in the sequence to be executed.

System_CAPS_pubpropertyState

Gets the state of the referenced object.(Inherited from SmoObjectBase.)

System_CAPS_pubpropertyUrn

Gets the Uniform Resource Name (URN) address value that uniquely identifies the object.(Inherited from SqlSmoObject.)

System_CAPS_pubpropertyUserData

Gets or sets user-defined data associated with the referenced object.(Inherited from SmoObjectBase.)

System_CAPS_pubpropertyVersionNumber

Gets a system-maintained value that is incremented every time the job is modified.

NameDescription
System_CAPS_pubmethodAddSharedSchedule(Int32)

Adds a shared schedule to the Microsoft SQL Server Agent job.

System_CAPS_pubmethodAlter()

Updates any Job object property changes on an instance of Microsoft SQL Server. 

System_CAPS_pubmethodApplyToTargetServer(String)

Adds a server to the list of target servers maintained for the referenced Microsoft SQL Server Agent job.

System_CAPS_pubmethodApplyToTargetServerGroup(String)

Adds one or more servers to the list of target servers maintained for the referenced Microsoft SQL Server Agent job.

System_CAPS_pubmethodCreate()

Creates a job on the instance of Microsoft SQL Server as defined by the Job object.

System_CAPS_pubmethodDeleteJobStepLogs(DateTime)

Deletes job step log files that are older than the specified date.

System_CAPS_pubmethodDeleteJobStepLogs(Int32)

Deletes job step log files that are larger that the specified log ID number.

System_CAPS_pubmethodDiscover()

Discovers a list of type Object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodDrop()

Removes an existing job.

System_CAPS_pubmethodDrop(Boolean)

Removes an existing job.

System_CAPS_pubmethodDropIfExists()

Drops the Job object if exists in the server.

System_CAPS_pubmethodEnumAlerts()

Enumerates a list of Agent alerts that cause automated execution of the referenced job.

System_CAPS_pubmethodEnumHistory()

Enumerates a list of execution history associated with the referenced job.

System_CAPS_pubmethodEnumHistory(JobHistoryFilter)

Enumerates a list of execution history associated with the referenced job.

System_CAPS_pubmethodEnumJobStepLogs()

Enumerates a list of job step log files for the referenced job.

System_CAPS_pubmethodEnumJobStepLogs(Int32)

Enumerates a list of job step log files for the job step with the specified ID value.

System_CAPS_pubmethodEnumJobStepLogs(String)

Enumerates a list of job step log files for the job step with the specified name.

System_CAPS_pubmethodEnumJobStepsByID()

Returns an array of JobStep objects that belong to the referenced job and that are ordered by ID value.

System_CAPS_pubmethodEnumTargetServers()

Enumerates a list of execution target servers that have been assigned to the referenced job.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFormatSqlVariant(Object)

Formats an object as T: Microsoft.Data.Schema.Sql.DataGenerator.SqlVariant type.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetContextDB()

Gets the context database that is associated with this object.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetDBName()

Gets the database name that is associated with the object.(Inherited from AgentObjectBase.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_protmethodGetPropValue(String)

Gets a property value of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetPropValueOptional(String)

Gets a property value of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetPropValueOptionalAllowNull(String)

Gets a property value of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_protmethodGetServerObject()

Gets the server of the SqlSmoObject object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodInitialize()

Initializes the object and forces the properties be loaded.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodInitialize(Boolean)

Initializes the object and forces the properties be loaded.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodInvoke()

Runs the job.

System_CAPS_protmethodIsObjectInitialized()

Verifies whether the object has been initialized.(Inherited from SqlSmoObject.)

System_CAPS_protmethodIsObjectInSpace()

Verifies whether the object is isolated or connected to the instance of SQL Server.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodIsSupportedProperty(String)

Determines whether the specified property is supported in the target .NET Framework.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodPurgeHistory()

Removes system records maintaining execution history for the referenced job.

System_CAPS_pubmethodRefresh()

Refreshes the object and retrieves properties when the object is next accessed.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodRemoveAllJobSchedules()

Removes all shared and unshared schedules from the job.

System_CAPS_pubmethodRemoveAllJobSchedules(Boolean)

Removes all unused schedules from the job.

System_CAPS_pubmethodRemoveAllJobSteps()

Removes all the job steps associated with the job.

System_CAPS_pubmethodRemoveFromTargetServer(String)

Removes an execution target server from the list of target servers maintained for a job.

System_CAPS_pubmethodRemoveFromTargetServerGroup(String)

Removes a group of execution target servers from the list of target servers maintained for a job.

System_CAPS_pubmethodRemoveSharedSchedule(Int32)

Removes the specified shared schedule from the job.

System_CAPS_pubmethodRemoveSharedSchedule(Int32, Boolean)

Removes the specified shared schedule from the job and keeps unused schedules.

System_CAPS_pubmethodRename(String)

Renames the job.

System_CAPS_pubmethodScript()

Generates a Transact-SQL script that can be used to re-create the Microsoft SQL Server Agent job.

System_CAPS_pubmethodScript(ScriptingOptions)

Generates a Transact-SQL script that can be used to re-create the Microsoft SQL Server Agent job as specified by the scripting options.

System_CAPS_protmethodSetParentImpl(SqlSmoObject)

Sets the parent of the SqlSmoObject to the newParent parameter.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodStart()

Runs the referenced job.

System_CAPS_pubmethodStart(String)

Runs the referenced job starting at the specified job step.

System_CAPS_pubmethodStop()

Stops executing the referenced job.

System_CAPS_pubmethodToString()

Returns a String that represents the referenced object.(Inherited from SqlSmoObject.)

System_CAPS_pubmethodValidate(String, Object[])

Validates the state of an object.(Inherited from SmoObjectBase.)

NameDescription
System_CAPS_pubeventPropertyChanged

Represents the event that occurs when a property is changed.(Inherited from SqlSmoObject.)

System_CAPS_pubeventPropertyMetadataChanged

Represents the event that occurs when property metadata changes.(Inherited from SqlSmoObject.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.Discover()

Discovers any dependencies.

Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.GetDomainRoot()

Returns the root of the domain.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.GetParent()

Gets the parent of this object. Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.GetPropertyType(String)

Gets the type of the specified property.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.GetPropertyValue(String, Type)

Gets the value of the specified property.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.GetUrn()

Gets the Unified Resource Name (URN) of the object.

Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.Resolve(String)

Gets the instance that contains the information about the object from the Unified Resource Name (URN) of the object.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.SetObjectState(SfcObjectState)

Sets the object state to the specified SfcObjectState value.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAlienObject.SetPropertyValue(String, Type, Object)

Sets the property value.(Inherited from SqlSmoObject.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodISfcPropertyProvider.GetPropertySet()

Gets the interface reference to the set of properties of this object.

Do not reference this member directly in your code. It supports the SQL Server infrastructure.(Inherited from SqlSmoObject.)

To get or set Job object properties, users must be a member of the SQLAgentUserRole database role on the MSDB database, or be the owner of the job, or be a member of the sysadmin fixed server role.

To create a job, users must be a member of the SQLAgentUserRole, SQLAgentReaderRole, and SQLAgentOperatorRole database roles on the MSDB database, or be a member of the sysadmin fixed server role.

To drop a job, users must be a member of the SQLAgentUserRole database role on the MSDB database, or be the owner of the job, or be a member of the sysadmin fixed server role.

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: