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
Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure and then click View Dependencies. View the list of objects that depend on the procedure.
Using SQL Server Management StudioExpand Stored Procedures, right-click the procedure and then select Script Stored Procedure as, and then select one of the following: Create To, Alter To, or Drop and Create To. Select New Query Editor Window. This will display the procedure definition.
You cannot call a stored proc from inside a view. It is not supported. However, you can make views call other views or table-valued user-defined functions. For the latter, you must make sure that you're using inline functions.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With