what''s my name?

  • 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

  • You can get an Id of the stored procedure by using the @@ProcID value and then quering sysobjects to get the name. 

  • Or use the buil in function

     

    OBJECT_NAME(<id> )

     

    just combine with Mike's comment.

  • 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