Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Delete SQL Agent Jobs owned by specific user

By Damien Alvarado,

I have a SQL Server 2008 to administer and I found out that there were many sql agent jobs that were no supposed to run and that were generating errors each time they fired. The common thread amongst the agent jobs were they were owned by a domain account that was no longer valid. The agent jobs all had GUIDs for the name so viewing the list of jobs was not very helpful. I wrote this script so I could first view the agent jobs that I wanted to delete, then I could uncomment line 32 and comment out line 33 when I wanted to actually call the stored procedure that purged the jobs. You enter the user's name you want to view/delete jobs for on line 12 and control the view/delete process on lines 32 and 33.

Total article views: 619 | Views in the last 30 days: 1
 
Related Articles
FORUM

Deleted SQL Server Agent Job

Deleted SQL Server Agent Job

FORUM

sql server agent

problem starting sql server agent when BuiltIn\Administrators account has been deleted

FORUM

Deleting Table

Deleting

FORUM

delete table

delete

FORUM

SQL Agent Agent

SQL Agent Agent

Tags
agent jobs    
msdb    
sql server agent    
 
Contribute