Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 List All Users connected to Database

Author  Topic 

gavinjb
Starting Member

34 Posts

Posted - 2007-12-14 : 04:44:59
Hi,

I need to be able to list all User connected to a particular database, after doing a bit of playing I have writen a simple view in the database to show this information which looks like

select spid, status, loginame, hostname, blocked, db_name(dbid), cmd from master..sysprocesses where db_name(dbid) = 'AutoCost2008

But my problem is that as this needs to be run from an application where the user is logged on as a standard user and therefore when this is run it only shows the current user, I am not sure what permissions I need to give this login to allow them to view all users connected to this database without giving them full Admin permissions, can anyone please help.


Thanks,


Gavin,

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-12-14 : 05:42:48
select permission but afaik, public role by default would have this permission and all users are members of the public role unless you've explicitly removed this permission as part of your security policy

--------------------
keeping it simple...
Go to Top of Page

gavinjb
Starting Member

34 Posts

Posted - 2007-12-14 : 06:02:22
yes the user is a member of public role and they can query the view but they are only seeing data relating to themselves, not data for any other user.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2007-12-14 : 06:41:34
AFAIK, you would need securityadmin or sysadmin to view others logins.
Go to Top of Page
   

- Advertisement -