• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

Parent procedure or function name

how to get parent procedure name in child procedure name
say
proc A
(
call Procc B
 )

proc B
(
--NEED PROC A NAME
)

0
jindalankush
Asked:
jindalankush
  • 4
  • 2
1 Solution
 
RiteshShahCommented:
You can't predict which procedure has called your PROC B. it could be called from PROC A or may be from PROC D or C anywhere. you can have parameter so that you can decide which procedure has called PROC B.
0
 
RiteshShahCommented:
create proc b (@procName varchar)
as
begin
select @procname
end


create proc a
as
begin
exec b 'a'
end

create proc c
as
begin
exec b 'c'
end


--run SP and check.
exec a

exec c
0
 
jindalankushAuthor Commented:
i need that proc name either its a proc A or proc D.
i can not pass any parameter
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RiteshShahCommented:
well in that case, I don't think so it is possible.
0
 
jindalankushAuthor Commented:
how can we find parent procedure name
0
 
RiteshShahCommented:
as I told you before also, it is not possible with the way you want. SQL Server is RDBMS not Object Oriented Language.
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now