List Active Users

  • Is there a way using T-SQL to get a list of active logins? What I'm looking for is something similar to what I can see in EM under Current Activity/Process Info. I am writing a script to shut down SQL Server but I want to make sure no one is connected to the server at the time.

    Francis

  • You can execute sp_who or sp_who2 with it is more complete.

    Every time you need to imitate something EM does in T-SQL it is good to execute a trace with profiler, to know what is EM executing.

    Remember that almost everything it is done with EM, it T-SQL code.

  • Also you can query the sysprocesses system table to see the current processes:

     
    
    select * from master..sysprocesses
  • Thanks guys. I'm on track now.

    Francis

  • Pass the 'active' as the parameter for sp_who.

    sp_who 'active'

Viewing 5 posts - 1 through 4 (of 4 total)

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