sp_update_job (Transact-SQL)
Özniteliklerini değiştirir bir iş.
sp_update_job [ @job_id =] job_id | [@job_name =] 'job_name'
[, [@new_name =] 'new_name' ]
[, [@enabled =] enabled ]
[, [@description =] 'description' ]
[, [@start_step_id =] step_id ]
[, [@category_name =] 'category' ]
[, [@owner_login_name =] 'login' ]
[, [@notify_level_eventlog =] eventlog_level ]
[, [@notify_level_email =] email_level ]
[, [@notify_level_netsend =] netsend_level ]
[, [@notify_level_page =] page_level ]
[, [@notify_email_operator_name =] 'email_name' ]
[, [@notify_netsend_operator_name =] 'netsend_operator' ]
[, [@notify_page_operator_name =] 'page_operator' ]
[, [@delete_level =] delete_level ]
[, [@automatic_post =] automatic_post ]
Bağımsız değişkenler
[ @job_id =] job_id
The identification number of the job to be updated.job_idis uniqueidentifier.[ @job_name =] 'job_name'
The name of the job.job_nameis nvarchar(128).Not
Ya dajob_idorjob_namebelirtilmiş olması gerekir, ancak her ikisi de belirtilemiyor.
[ @new_name =] 'new_name'
The new name for the job.new_nameis nvarchar(128).[ @enabled =] enabled
Specifies whether the job is enabled (1) or not enabled (0).enabledis tinyint.[ @description =] 'description'
The description of the job.description is nvarchar(512).[ @start_step_id =] step_id
The identification number of the first step to execute for the job.step_idis int.[ @category_name =] 'category'
The category of the job.categoryis nvarchar(128).[ @owner_login_name =] 'login'
The name of the login that owns the job.loginis nvarchar(128) Only members of the sysadmin fixed server role can change job ownership.[ @notify_level_eventlog =] eventlog_level
Specifies when to place an entry in the Microsoft Windows application log for this job.eventlog_levelis int, and can be one of these values.Değer
Açıklama (eylem)
0
Hiçbir zaman
1
Başarı
2
Hatası
3
Her zaman
[ @notify_level_email =] email_level
Specifies when to send an e-mail upon the completion of this job.email_levelis int.email_leveluses the same values as eventlog_level.[ @notify_level_netsend =] netsend_level
Specifies when to send a network message upon the completion of this job.netsend_levelis int.netsend_leveluses the same values as eventlog_level.[ @notify_level_page =] page_level
Specifies when to send a page upon the completion of this job.page_levelis int.page_leveluses the same values as eventlog_level.[ @notify_email_operator_name =] 'email_name'
The e-mail name of the operator to whom the e-mail is sent when email_level is reached.email_name is nvarchar(128).[ @notify_netsend_operator_name =] 'netsend_operator'
The name of the operator to whom the network message is sent.netsend_operator is nvarchar(128).[ @notify_page_operator_name =] 'page_operator'
The name of the operator to whom a page is sent.page_operator is nvarchar(128).[ @delete_level =] delete_level
Specifies when to delete the job.delete_valueis int.delete_leveluses the same values as eventlog_level.[ @automatic_post =] automatic_post
Ayrılmış.
Dönüş Kodu Değerleri
0 (başarılı) veya 1 (hata)
Remarks
sp_update_job çalıştırılmalıdır msdb veritabanını.
sp_update_job , hangi parametre değerleri sağlanacak olan ayarlarını değiştirir.Parametre belirtilmezse, geçerli ayarı korunur.
İzinler
Varsayılan olarak, üye sysadmin sabit sunucu rolü Bu saklı yordamı çalıştırabilirsiniz.Aşağıdakilerden birini diğer kullanıcılara verilmelidir SQL Server Veritabanı rollerini sabit Aracısı msdb veritabanı:
SQLAgentUserRole
SQLAgentReaderRole
SQLAgentOperatorRole
Bu roller, izinler hakkında daha fazla bilgi için bkz: SQL Server Agent Database Roles sabit.
Yalnızca üyeleriSistem Yöneticisi , sahibi olduğu diğer kullanıcıların. işleri özniteliklerini düzenlemek için bu saklı yordam kullanabilirsiniz
Örnekler
Aşağıdaki örnek, adı, açıklamayı değiştirir ve etkin iş durumuNightlyBackups.
USE msdb ;
GO
EXEC dbo.sp_update_job
@job_name = N'NightlyBackups',
@new_name = N'NightlyBackups -- Disabled',
@description = N'Nightly backups disabled during server migration.',
@enabled = 0 ;
GO