开发者

ProcID lineage identification

I am working with SQL Server 2008 and need for stored proc B to be able to give (whether that means storeor print etc...) the name/id of stored proc A which called it. I.e. I would like to find the value of the parent of @@Pr开发者_开发知识库ocID.

I have seen the question has been asked but not given a satisfactory answer (from Microsoft or any online community) so I thought there would be a clevr solution using sp_who in combination with master..sysprocesses but I haven't come up with one.


I don't believe there is a way to do this in SQL Server. However, you could have a look at this solution (and the feature request he references)

http://www.thecodepage.com/post/TIP-A-Call-Stack-in-SQL-Server.aspx

Alternatively, why not just make it a requirement that the calling SP passes it's name as one of the parameters. If both SPs are under your ownership this would probably be the easiest (and quickest, most efficient) solution

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜