Stored procedure

  • Is there any function in sql server to get the current stored procedure name.

    Context is I want to log the stored procedure name into a table once the procedure starts.

  • OBJECT_NAME(@@SPID)

    _____________
    Code for TallyGenerator

  • isn't it @@proc_id? so object_name(@@proc_id), rather than the @@spid?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Sorry, being brain dead.

    _____________
    Code for TallyGenerator

  • And for SQL Server 2005, you have to drop the underscore

    SELECT OBJECT_NAME(@@procid)

     

     


    N 56°04'39.16"
    E 12°55'05.25"

  • Thanks. Thank you so much to all. It is working fine..

  • can any body tell me " How to create a procedure from two databases?"

  • You should start a new topic.

    But... One way is to use fully qualified names.

     


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply