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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 determine if store proc is running

Author  Topic 

hai
Yak Posting Veteran

84 Posts

Posted - 2009-03-20 : 17:04:09
Hi all

I 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.
Go to Top of Page

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.
Go to Top of Page

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 :)
Go to Top of Page

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
Go to Top of Page

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.
Go to Top of Page
   

- Advertisement -