Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stored procedures to monitor job activity

Author  Topic 

nino.dago
Starting Member

2 Posts

Posted - 2011-11-10 : 08:16:19
Hi to all,
I'm a newbie in this forum and in SQL programming.
I have some questions about some stored procedures I have to do.

I have two tables in a database. The first one contains a list of jobs and some parameters (eg. medium job duration, max job duration, notification email), while the second one is a log table, matching with the first and giving infos about any warning or errors for each job or for overtaking of medium and max limits).

I know there are various System Stored Procedures (eg. sp_help_job, sp_help_jobactivity) which give these informations, but I'd like to know if somebody could share some SQL code snippet to call properly these sp inside a custom and bigger stored procedure.

As an alternative, it could be useful to know how to do stored procedures which perform following tasks:
- list all running jobs
- list all warning or errors for a job
- receiving duration value, filter the jobs by that value
- send email to administrator

Thanks in advance for replies
Bye
Nino

X002548
Not Just a Number

15586 Posts

Posted - 2011-11-10 : 09:53:25
exec msdb..sp_help_job

exec msdb..sp_help_jobactivity

We need more info of what you are trying to do..I didn't get it

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-10 : 10:03:25
see

http://beyondrelational.com/blogs/manjunathcbhat/archive/2011/04/24/get-information-on-all-jobs-running-on-a-sql-server-instance.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -