sp_manage_jobs_by_login (Transact-SQL)

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Deletes or reassigns jobs that belong to the specified login.

|Applies to: SQL Server ( SQL Server 2008 through current version).|

Topic link icon Transact-SQL Syntax Conventions


     [ @action = ] 'action'  
     [, [@current_owner_login_name = ] 'current_owner_login_name']  
     [, [@new_owner_login_name = ] 'new_owner_login_name']  


[ @action= ] 'action'
The action to take for the specified login. action is varchar(10), with no default. When actionis 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'
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'
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



To run this stored procedure, users must be granted the sysadmin fixed server role.


The following example reassigns all jobs from danw to fran├žoisa.

USE msdb ;  

EXEC dbo.sp_manage_jobs_by_login  
    @action = N'REASSIGN',  
    @current_owner_login_name = N'danw',  
    @new_owner_login_name = N'fran├žoisa' ;  

See Also

sp_delete_job (Transact-SQL)
System Stored Procedures (Transact-SQL)