Search Suggest

SQL Server, where are your job stored?

Hi Guys,

Welcome back!

I am getting older, oh yes it's true.

My 10 years old son is developing an app for the smartphone.
Today he told me that we need to registry to a forecast wheather site in order to get an Api Key.
Using this API he will parse the result returned in JSON format.
OMG!


Proud, i want to go back to the today's topic.


Where are SQL Server Jobs stored?

Well, such as a clear question deserves an aswer that is equally so!

You SQL Server JOB are stored into the MSDB database.
The MSDB database is created during the installation procedure.
There are tree tables involved.
The first table called sysjobs contain the list of your jobs.
A second table called sysjobsteps contain for each job a list of its steps.
The last table called syscategories contain the category of your job.

In an easy way you can use the T-SQL command below to get you list.

 

       
SELECT
job.job_id,
job.notify_level_email,
job.name,
job.enabled,
job.description,
cat.name,
steps.step_id,
steps.step_name,
steps.command,
steps.server,
steps.database_name
FROM msdb.dbo.sysjobs job
JOIN msdb.dbo.sysjobsteps steps ON job.job_id = steps.job_id
JOIN msdb.dbo.syscategories cat ON job.category_id = cat.category_id
WHERE
job.enabled = 1 -- remove this if you wish to return all jobs



The result will be like this:



That’s all for today! 
It's saturday and everyone deserves some time to rest.
Don't blame me: i only stole 5 minute from you!!! 

 
I hope you liked this post and found it useful subscrive and take a look also to the others post!
I am counting on it!
Luca

SQL: READY TO RUN FASTER?











Post a Comment