August 29, 2007 at 1:42 pm
Hi All,
Does a stored procedure know it's own name at run time?
I would like to be able to have proc's reference their names at run time similar to the way "system_user" references the current login.
I don't see anything in BOL that implies that there is a comparable value for a proc.
Thx,
Elliott
August 29, 2007 at 1:52 pm
You can get an Id of the stored procedure by using the @@ProcID value and then quering sysobjects to get the name.
August 29, 2007 at 1:57 pm
Or use the buil in function
OBJECT_NAME(<id> )
just combine with Mike's comment.
August 29, 2007 at 2:17 pm
Thanks Mike and Andras.
That's the answer. I guess I should have researched server variables instead of stored procedures.
Cheers,
Elliott
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply