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
 Transact-SQL (2000)
 Concurrent stored procs?

Author  Topic 

jek
Starting Member

9 Posts

Posted - 2004-03-08 : 19:06:15
Hi all

I have a stored proc that runs every 4 hours - as a job. The stored proc takes about 3-5 minutes to comple, depending on number of records.
To do testing we run that stored proc manually, also.
Sometimes 2 or more people may run the same stored proc without knowing that the other person is running. This may create duplicates entries once processed.

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.
(May be semapohres,mutex or something like that?)

(I am trying not to use a table to store whether the stored proc is running or not)


Thanks in advance.

Rochana

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2004-03-08 : 20:02:45
Why don't you make them run it through the jobs interface ? (Right click, execute job)
That way the jobs engine will take care of it.

Other than that, the only way to do it is to store that it's running somewhere, and that somewhere needs to be a table.


Damian
Go to Top of Page

jek
Starting Member

9 Posts

Posted - 2004-03-08 : 21:22:56
Yes it seems there's no option than that.

Thanks Damian.


quote:
Originally posted by Merkin

Why don't you make them run it through the jobs interface ? (Right click, execute job)
That way the jobs engine will take care of it.

Other than that, the only way to do it is to store that it's running somewhere, and that somewhere needs to be a table.


Damian

Go to Top of Page
   

- Advertisement -