sp_manage_jobs_by_login (T-SQL)
Deletes or reassigns jobs belonging to the specified login.
Syntax
sp_manage_jobs_by_login [@action =] 'action'
[, [@current_owner_login_name =] 'current_owner_login_name']
[, [@new_owner_login_name =] 'new_owner_login_name']
Arguments
- [@action =] 'action'
- Is the action to take for the specified login. action is varchar(10), with no default. When action is DELETE, sp_manage_jobs_by_login deletes all jobs owned by current_owner_login_name. When action is REASSIGN, all jobs are assigned to new_owner_login_name.
- [@current_owner_login_name =] 'current_owner_login_name'
- Is the login name of the current job owner. current_owner_login_name is sysname, with no default.
- [@new_owner_login_name =] 'new_owner_login_name'
- Is the login name of the new job owner. Use this parameter only if action is REASSIGN. new_owner_login_name is sysname, with a default of NULL.
Return Code Values
0 (success) or 1 (failure)
Result Sets
None
Permissions
Only members of the sysadmin fixed server role can execute sp_manage_jobs_by_login.
Examples
This example reassigns all jobs from janetl to stevenb.
USE msdb
EXEC sp_manage_jobs_by_login 'REASSIGN', 'janetl', 'stevenb'
See Also
(c) 1988-98 Microsoft Corporation. All Rights Reserved.