Reputation: 8146
I've got a stored procedure which is called from some piece of code. But I cannot understand exactly which one.
Is it possible to ask to the Database or the network to monitor that SP to find who is the caller? How?
The database is SQL Server (one of the latest versions)
Upvotes: 0
Views: 113
Reputation: 598
I'm not sure if this is the correct answer, but when I connect via my local computer and run this, I can get my IP address. I do not believe SQL server would be able to identify what web page is making the call, but rather knowing that "I have a connection from X", as such, you would need to add the "Application Name" to the connection string. This can be pulled out of the activity monitor.
Use Application Name in SQL Server
SELECT session_id, client_net_address, hostname, program_name
FROM
sys.dm_exec_connections c
INNER JOIN
sys.sysprocesses s on
c.session_id = s.spid
WHERE
session_id = @@spid
Upvotes: 1