September 1, 2005 at 10:43 am
Does anyone know of a way to retrieve the name of the calling (parent) stored procedure, from within the nested (called) SP? Passing in the name of the parent is NOT what I have in mind, BTW.
Thanks,
Joe
September 1, 2005 at 11:51 am
If you can't pass something to the callee you're screwed. You'll have to change the code in all the calling procs to accomplish this. And the simplest way would be to pass the name directly (having it fetched from the system tables to keep accuracy and fast copy/paste to update the code).
September 3, 2005 at 12:50 am
you could implement a stack in a table with fields @@SPID, iLevel, procname in it and refer to that. Make a sp to push a procname on entry and then a sp to pop a procname on exit. Then make a sp to get the last procname for a given @@SPID. That will be the caller.
September 3, 2005 at 7:31 am
Nice plan... but it still requires changing every single proc. I think it would be simpler to just send the calling spid .
September 3, 2005 at 9:07 am
yeah if you can change all the procs interfaces, just pass the calling proc's name. If you can't, then you can store them in a table.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply