How can i see what IP address made the request to SQL Server?

HotFrost picture HotFrost · Nov 4, 2009 · Viewed 21.2k times · Source

i need to clearly see what IP address made what sql query to SQL server. I am trying to use SQL Profiler, but it seems there is no way i can somehow to differentiate the machine (browser) where the query came from. It only has the communication details between the web server and the sql server. Is there ANY way for me (any unknown log?) that will allow me to see the identification of the original machine where the query came from?

Thanks for any suggestion.

HF

Answer

joshperry picture joshperry · Nov 4, 2009

You can get the hostname of the current connection, or really any information from the sysprocesses table

SELECT hostname FROM sys.sysprocesses WHERE spid = @@SPID

This obviously won't work to get the ip address of web hosts if that's what you're looking for.