Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SP

Author  Topic 

WoodHouse
Posting Yak Master

211 Posts

Posted - 2010-02-10 : 04:53:50
Store Procedure Test1 is calling store procedure B

Store Procedure Test2 is calling store procedure B

Question

From the store procedure B, Is it possible to find out the name of calling SP (SP name should not be passed as parameter


Help on this...
thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2010-02-10 : 05:13:07
No you can't do that. I am afraid you will have to paas it by paramater value.

Harsh Athalye
http://www.letsgeek.net/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-10 : 06:29:27
Have a look at @@PROCID

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-10 : 06:33:23
quote:
Originally posted by madhivanan

Have a look at @@PROCID

Madhivanan

Failing to plan is Planning to fail


@@PROCID returns the id of currently executing T-SQL module.
I think OP wants a method to determine inside procedure B whether call has come from Store Procedure Test1 or Test2. So I think he might need to pass the procname as a parameter as suggested by Harsh

------------------------------------------------------------------------------------------------------
SQL Server MVP
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-10 : 07:33:29
quote:
Originally posted by visakh16

quote:
Originally posted by madhivanan

Have a look at @@PROCID

Madhivanan

Failing to plan is Planning to fail


@@PROCID returns the id of currently executing T-SQL module.
I think OP wants a method to determine inside procedure B whether call has come from Store Procedure Test1 or Test2. So I think he might need to pass the procname as a parameter as suggested by Harsh

------------------------------------------------------------------------------------------------------
SQL Server MVP


Yes. Instead of name, pass id

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -