如何从存储过程中识别存储过程的调用者
我有一个已弃用的存储过程,不应再从代码中调用它,但有一些系统仍在调用它。这是一个生产服务器,因此我对它进行诊断的间接访问非常有限。
有没有办法确定从存储过程中调用特定存储过程的机器?例如 @@CallingMachineIP 或 @@CallingMachineName
I have a deprecated stored procedure which should no longer be called from code, but there is some system which is still calling it. This is a production server so I have very limited indirect access to it for performing diagnostics.
Is there any way to determine the machine which is calling a particular stored procedure from within the sproc? Something such as @@CallingMachineIP or @@CallingMachineName
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者
or
@@SPID
应该为您提供当前进程 ID。然后,
select * from master.dbo.sysprocesses 其中
spid = @@SPID
您可以从这些列之一获取您需要的内容。
@@SPID
should give you the current process ID.Then,
select * from master.dbo.sysprocesses where
spid = @@SPID
You can get what you need from one of those columns.