Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Findout Calling procedure name using @@PROCID

Sep 6 2010 3:23AM by Madhivanan   

Suppose you want to find out the name of the procedure that calls the procedure being executed,you can use system function @@PROCID which returns the object id of the current procedure.

Consider the following procedures. test1 calls the procedure test2 which actually logs some informations to the log table. What, if you want to know the calling procedure name also?. test2 accepts @@procid as input parameter and with the help of the object_name function, the name of the calling procedure is known inside the procedure test2. It is also possible to know in any number of procedures. Note that when you execute the procedure test1, it calls both test2 and test3 who know the calling procedure name.

create procedure test1
as
declare @procid int
set @procid=@@procid
exec test2 @procid
exec test3 @procid

go

create procedure test2(@procid int)
as
--Some stuff
--Log the source if any error
If @@error<>0
insert into log_table(procedure_name,column_list)
select object_name(@procid),....
GO

create procedure test3(@procid int)
as
select object_name(@procid) as calling_procedure

 

Result

calling_procedure
-----------------
test1

Tags: t-sql, sql_server, procedure, tsql, BRH, #TSQL, @@procid, #SQLServer,


Madhivanan
3 · 40% · 12924
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

2  Comments  

  • Is there a way to find this info without passing @@ProcID ?

    commented on Jan 10 2011 2:56PM
    Naomi
    31 · 6% · 1776
  • I dont think there is a way without passing it. Otherwise you may need to pass the procedure name directly.

    commented on Jan 11 2011 1:54AM
    Madhivanan
    3 · 40% · 12924

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]