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)
 Two stored procedure questions...

Author  Topic 

aiken
Aged Yak Warrior

525 Posts

Posted - 2003-05-31 : 13:26:42
A couple of quick ones; odds are the simple answers are "no" and "no", so that should be easy.
  1. Is it possible to EXEC a stored procedure asynchronously? That is, from within a stored procedure I want to fire off another procedure, but I don't need any results and don't care about any errors. Any way to do that?
  2. Is it possible to find out anything about the calling SQL, connection, or stored procedure? I've got a stored procedure that uses sp_OAcreate and it's causing memory leaks. I've eradicated 99% of the calls to it, but it's still being called from somewhere, and I just can't find it. I've searched syscomments, the application code, everywhere. I think some programmer coded it as szSP="dbo.p_BadPro" & "cedure" or something just to be diffuclt. Well, maybe not, but I still can't find it. Any ideas?


Thanks
-b

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-31 : 13:38:48
Procedures can be called from a JOB, have you checked using EM under

MANAGEMENT, SQL SERVER AGENT, JOBS

--

If you really must execute a procedure asynchronously, try scheduling it as a job, then you can easily enable (or start) it from your procedure when you want it to run.

Sam

Go to Top of Page

aiken
Aged Yak Warrior

525 Posts

Posted - 2003-05-31 : 14:34:56
Hmm... I'll look into it. Problem is, we're talking about thousands of executions per day.

That does suggest, though, that maybe rather than running the procedure, I can just populate a table with parameters for it and then have a job run periodically that loops through that table and runs the procedure once for each row. Hmm.

Thanks
-b

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-05-31 : 15:40:12
That'd be even better if you could re-write the procedure to do everything all at once in a set based manner, using the table of parameters.

That would be extremely efficient ...


- Jeff
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-05-31 : 15:42:11
As for the "bad" stored procedure, you could try removing permissions completely from the bad procedure ... that'll tell you soon enough who is using it when the developer calls you up and says his app isn't working !!

but if mission-critical stuff is running constantly and that procedure is involved, maybe not a good idea ...



- Jeff

Edited by - jsmith8858 on 05/31/2003 15:42:49
Go to Top of Page
   

- Advertisement -