BQ Stored procedure to to get the SP name

Hi,

I have stored procedure running in scheduled basis and i need to capture the running SP name to store in the separate audit table. Any options available to capture the name in the same running SP itself

0 1 78
1 REPLY 1

Hello,

Thank you for contacting the Google Cloud Community.

Using the @@SPID and sp_who System Functions:

1. Retrieve the current SP ID: Use the @@SPID system function to obtain the unique identifier of the currently executing stored procedure.
2. Query sp_who: Execute the sp_who system procedure with the @@SPID as a parameter to retrieve detailed information about the running stored procedure, including its name.
3. Store the name: Store the retrieved SP name in the audit table.

Regards,
Jai Ade