| title | sp_manage_jobs_by_login (Transact-SQL) | ||
|---|---|---|---|
| description | sp_manage_jobs_by_login deletes or reassigns jobs that belong to the specified login. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Deletes or reassigns jobs that belong to the specified login.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_manage_jobs_by_login
[ @action = ] 'action'
, [ @current_owner_login_name = ] N'current_owner_login_name'
[ , [ @new_owner_login_name = ] N'new_owner_login_name' ]
[ ; ]
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.
The login name of the current job owner. @current_owner_login_name is sysname, with no default.
The login name of the new job owner. @new_owner_login_name is sysname, with a default of NULL. Use this parameter only if @action is REASSIGN. @new_owner_login_name is sysname, with a default of NULL.
0 (success) or 1 (failure).
None.
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;
GO
EXECUTE dbo.sp_manage_jobs_by_login
@action = N'REASSIGN',
@current_owner_login_name = N'danw',
@new_owner_login_name = N'françoisa';
GO