Mapping spid to windows login to user query

  • Hello,

    Here is my scenario:

    Our clients access their database via IIS with their windows account. When their session is established, their login shows up as a SQL login we assigned to the database. The dillema I have is when I am trying to troubleshoot a runaway query. Since all the clients come into SQL with the SQL login instead of their Windows login, it is near impossible to narrow down whose query it is. My question is, is there a way to map a spid to the windows login and then to the actual T-SQL language. This would allow me to analyze the query and educate the user if it is inefficient. Feedback would be greatly appreciated.

  • Try this.

    select spid, hostname, program_name, nt_domain, loginame from sysprocesses

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply