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.
| Author |
Topic |
|
rds207
Posting Yak Master
198 Posts |
Posted - 2010-03-23 : 18:14:28
|
| Hi I have created some 15 Jobs , but some jobs seems to be hanging sometimes, could any one please assist me in creating an stored procedure for alerting me with an email , when the run duration is > 18000seconds (5 hrs)?I wanted to create a package which queries the Data in MSDB.SYSTABLES.DBO.SYSJOBHISTORY table , and looks for the Jobs which has runduration > 18000 and send me an email ....Please let me knwo how do i create a package and Job for this...Any inputs are highly apreaciated...Thank you |
|
|
rds207
Posting Yak Master
198 Posts |
Posted - 2010-03-23 : 18:41:38
|
quote: Originally posted by rds207 I created a Job with the Job Step having following syntax SELECT * FROM sysjobhistoryWHERE run_duration >= '18000' and run_date > getdate() - 3BEGINEXEC msdb.dbo.sp_send_dbmail @profile_name = 'qctreport', @recipients = 'emailaddress(mine)', @subject=N'ALERT :: ASWReport Data is out of sync...' ;ENDGOBut i get an error as the run_date value is in format 20100321,So how do i chaneg the syntax where the query check data for last 3 days from today , quote: Originally posted by rds207 Hi I have created some 15 Jobs , but some jobs seems to be hanging sometimes, could any one please assist me in creating an stored procedure for alerting me with an email , when the run duration is > 18000seconds (5 hrs)?I wanted to create a package which queries the Data in MSDB.SYSTABLES.DBO.SYSJOBHISTORY table , and looks for the Jobs which has runduration > 18000 and send me an email ....Please let me knwo how do i create a package and Job for this...Any inputs are highly apreaciated...Thank you
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-24 : 00:40:52
|
| whats the datatype of run_date ?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
bhaskarvarada
Starting Member
8 Posts |
Posted - 2010-03-24 : 01:14:31
|
| Hi rds207, U need to cast the run_date as datetime, in SysJobHistory Run_date has integer data_type,so use cast(run_date as datetime) Rgds, |
 |
|
|
|
|
|
|
|