Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. get list of connected users

get list of connected users

Scheduled Pinned Locked Moved Database
databasesysadminquestionsql-server
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Danzy83
    wrote on last edited by
    #1

    Hi everyone! I need to get a list of users connected to a database. I want to implement a fuctionality in my application that allows users connected to the database to communicate. For instance one administrator in his office can request or send information to another in an office through the network. A user executing 'select * from master..sysprocesses' does not show all connected users but only the one executing the command. How do I get users to view list of connected users so that they select the one they need to communicate with? I'm using Sql Server 2005. Thanks in advance.

    L D 2 Replies Last reply
    0
    • D Danzy83

      Hi everyone! I need to get a list of users connected to a database. I want to implement a fuctionality in my application that allows users connected to the database to communicate. For instance one administrator in his office can request or send information to another in an office through the network. A user executing 'select * from master..sysprocesses' does not show all connected users but only the one executing the command. How do I get users to view list of connected users so that they select the one they need to communicate with? I'm using Sql Server 2005. Thanks in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I'm not sure, but I believe that you need to be a sysadmin member to view which other users are connected. Since you (probably) will not promote every user to an admin, I'd suggest rolling your own. It's quite easy to create a table with a username and a datetime of login. Insert the users' name when he/she logs in, delete it if they logout or are inactive for a specified period of time.

      Bastard Programmer from Hell :suss:

      1 Reply Last reply
      0
      • D Danzy83

        Hi everyone! I need to get a list of users connected to a database. I want to implement a fuctionality in my application that allows users connected to the database to communicate. For instance one administrator in his office can request or send information to another in an office through the network. A user executing 'select * from master..sysprocesses' does not show all connected users but only the one executing the command. How do I get users to view list of connected users so that they select the one they need to communicate with? I'm using Sql Server 2005. Thanks in advance.

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        You can look at these commands, but I beleive you need elevated permissions to see other people on the server. Maybe you could write a web service that connects to the database with Admin privs and returns the list of users for each request. This would allow you current user configuration no to change, just some additional functionality would be published. Just a thought. Remeber to vote. :cool:

        D 1 Reply Last reply
        0
        • D David Mujica

          You can look at these commands, but I beleive you need elevated permissions to see other people on the server. Maybe you could write a web service that connects to the database with Admin privs and returns the list of users for each request. This would allow you current user configuration no to change, just some additional functionality would be published. Just a thought. Remeber to vote. :cool:

          D Offline
          D Offline
          Danzy83
          wrote on last edited by
          #4

          Thanks David and Eddy. I got the solution. It is done by executing 'GRANT VIEW SERVER STATE TO [LOGIN]' at the server scope. It works now.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups