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 |
hai
Yak Posting Veteran
84 Posts |
Posted - 2009-03-20 : 17:04:09
|
Hi allI have a stored proc that runs every 2 hours - as a job. The stored proc takes about 3-5 minutes to complete, depending on number of records. What I want to know is, Is there a way to check if that stored procedure is currently running. If so it wont run second time concurrently. |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-20 : 17:08:11
|
you can run sp_who2 'active' to see all the active sessions and details. |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2009-03-23 : 11:53:59
|
Amend the core SP so that records it's own start/end times. then query this log. |
|
|
tripodal
Constraint Violating Yak Guru
259 Posts |
Posted - 2009-03-25 : 10:35:06
|
You coudl also use SQL agent, it shows last run time, next runtime and status. that does require you to you EM, which doesnt seem that popular :) |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2009-03-25 : 12:18:56
|
msdb.dbo.sp_help_job will tell you the current run status of all jobs. elsasoft.org |
|
|
hai
Yak Posting Veteran
84 Posts |
Posted - 2009-03-26 : 08:18:12
|
thank you for all the suggestions...I will take a look at sp_help_job. |
|
|
|
|
|