Script for SQL Server Agent jobs

The below script is useful in finding the important information about the jobs in your SQL Server like who is the owner of your job, if you have set any notification email or not if it set then to which Emailid the mail will be sent to, when it was created and when was the job last modified. GitHub link.

-- Query to find the important information about SQL Server Agent Jobs

SELECT	sj.name Job_Name,
		sj.description Job_Description, 
		lo.name Job_Owner, 
		sj.enabled Is_Enabled, 
		so.email_address Notification_EmailId, 
		sj.date_created Job_CreateDate, 
		sj.date_modified Job_ModifiedDate
FROM msdb.dbo.sysjobs sj
LEFT JOIN msdb.dbo.sysoperators so
		ON sj.notify_email_operator_id = so.id
LEFT JOIN sys.syslogins lo
		ON sj.owner_sid = lo.sid

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s