November 7, 2003 at 8:56 am
Is there any way to get a procedure name from within the procedure, without
hardcoding it. I am trying to write a generic error reporting procedure, that
would be used by all the applications. To track down which procedure is
reporting the error, I need to pass the procedure name as a parameter. Using
Object_Name would not work since it needs a parameter. I essentially need something
like this that takes no parameters, and returns the current procedure name.
thanks.
November 7, 2003 at 9:06 am
@@PROCID will return the id of the current stored procedure. You can then look this id up in the sysobjects table to find the procedure name.
regards
November 7, 2003 at 9:17 am
Though its not recommended, but u can get the proc names from sysobjects in master database. Good luck.
November 7, 2003 at 9:59 am
OBJECT_NAME(@@PROCID)
--Jonathan
--Jonathan
November 7, 2003 at 11:03 am
That just works perfect.
Thank You All.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply