Friday, February 24, 2012

Capture name of stored procedure within itself?

Is there any way of capturing the name of a stored procedure during
execution?
I've created a generic stored procedure to handle much of my error
handling. I would like to be able to have the calling stored
procedure to pass its name as one of the parameters to the error
handling proc to be logged on certain error messages events.
I could easily hard code the stored procedure name on all of the
calls, but I am trying to create a series of generic code blocks to
add to the stored procedures (one for simple SELECTS, UPDATE, INSERTS,
ETC), so I was hoping to find a function or create a function that
would give the name of the proc.
Any thoughts would be appreciated.SELECT OBJECT_NAME(@.@.PROCID) AS ProcName
"Sean O'Thule" <othule@.hotmail.com> wrote in message
news:63840202.0408300912.2d9c1f2c@.posting.google.com...
> Is there any way of capturing the name of a stored procedure during
> execution?
> I've created a generic stored procedure to handle much of my error
> handling. I would like to be able to have the calling stored
> procedure to pass its name as one of the parameters to the error
> handling proc to be logged on certain error messages events.
> I could easily hard code the stored procedure name on all of the
> calls, but I am trying to create a series of generic code blocks to
> add to the stored procedures (one for simple SELECTS, UPDATE, INSERTS,
> ETC), so I was hoping to find a function or create a function that
> would give the name of the proc.
> Any thoughts would be appreciated.|||Great, thanks

No comments:

Post a Comment