Monday, March 26, 2012

Is there a function that returns the name of the executing sproc?

Greetings,

I've got a stored procedure that returns execution feedback information through OUTPUT parameters. One of the parameters contains the name of the stored procedure.

I'd like to be able to derive the name of a stored procedure without hard-coding it, which I obviously could do. I'm wondering if there is a system function or another approach that would allow me to grab the procedure name on the fly. I've got many procedures that are doing the same thing so I want to generalize this common code as much as possible.

Ideally, I would like something like this:

SET @.ProcedureName = GETPROCEDURENAME()

Thanks,

BCB

yes..

SET @.ProcedureName = object_name(@.@.ProcID)

No comments:

Post a Comment