So I've got multiple stored procedures that call another stored procedure. I need to know which stored procedure did the calling when it happens.
To clarify, let's say that Sproc1 and Sproc2 both sometimes call Sproc3. Whenever Sproc3 is called, I want it to do something special if it was called by Sproc2, but not if it was called by Sproc1, so I need to know which stored procedure called Sproc3 each time it's called.
The obvious solution is to have Sproc1 and/or Sproc2 pass a variable to Sproc3 saying who the caller was. Unfortunately, Sproc1 and Sproc2 are both written by another company that's a pain in the &^% to work with. We're not allowed to modify their sprocs, and we don't have the time and money to invest in having them do it.
So is there a way within Sproc3 to know what stored procedure called it?