How to identify the caller of a Stored Procedure from within the Sproc

爷,独闯天下 提交于 2019-12-03 12:26:41
select hostname from master..sysprocesses where spid=@@SPID

or

select host_name from sys.dm_exec_sessions where session_id=@@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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!