Get Job Details from Sql Server 2005

We are doing a database audit and we had to get all the jobs running on a particular server and the time at which it is run. So wrote a quick script as given below to get it:

SELECT
 [Name],
 'Scheduled at ' + LEFT(RIGHT('000000' + CAST(next_run_time AS VARCHAR(10)),6),2) + ':' +
 SUBSTRING(RIGHT('000000' + CAST(next_run_time AS VARCHAR(10)),6),3,2) + ':' +
 RIGHT(RIGHT('000000' + CAST(next_run_time AS VARCHAR(10)),6),2)
FROM
 dbo.sysjobs j LEFT OUTER JOIN dbo.sysJobSchedules s ON
 j.job_id=s.job_id

Hope it helps.

Happy Programming!!!

Cheers,

Raja

Advertisements

0 Responses to “Get Job Details from Sql Server 2005”



  1. Leave a Comment

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s





%d bloggers like this: