Solved

Parent procedure or function name

Posted on 2009-05-14
7
567 Views
Last Modified: 2012-05-07
how to get parent procedure name in child procedure name
say
proc A
(
call Procc B
 )

proc B
(
--NEED PROC A NAME
)

0
Comment
Question by:jindalankush
  • 4
  • 2
7 Comments
 
LVL 31

Accepted Solution

by:
RiteshShah earned 50 total points
ID: 24383377
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
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24383394
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
 
LVL 4

Author Comment

by:jindalankush
ID: 24383409
i need that proc name either its a proc A or proc D.
i can not pass any parameter
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 31

Expert Comment

by:RiteshShah
ID: 24383434
well in that case, I don't think so it is possible.
0
 
LVL 4

Author Comment

by:jindalankush
ID: 24409314
how can we find parent procedure name
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24409322
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now