7

For my VFP application, i have a program to check currently who is accessing the server (by using sp_who2), also another progam to check who is currently locking which table.

But i wish to know which options my users is accessing at the moment. Am thinking if i can write a SP to get the current connected process ID for a specific client, and insert to a table(ActLog) in SQL with the program name pass into this table during users load the program. And delete that particular record when user unload the program.

Then from the ActLog, i can know who is currently accessing to which program. At the moment, i wish to know if i able to get the client process ID?

rgds/Andrea

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
Andrea.Ko
  • 119
  • 4
  • 12

1 Answers1

7

host_process_id in sys.dm_exec_sessions:

Process ID of the client program that initiated the session

Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569
  • Thanks for your reply. How to i know which records is my current connected session? – Andrea.Ko Jun 02 '10 at 02:11
  • 5
    i am able to get my current connected session by executing the following: SELECT session_id, login_time, login_name, host_name, host_process_id , status FROM sys.dm_exec_sessions where session_id = @@SPID – Andrea.Ko Jun 02 '10 at 02:53