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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Get list of users for Database
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

BryanBurroughs
Starting Member

USA
8 Posts

Posted - 05/12/2010 :  14:04:59  Show Profile  Reply with Quote
Howdy all,
I've got a SQLServer 2005 (*gasp*) installation on Win2k3 Server and am trying to get a list of the users that have access to the database. I've set up a view as follows:

SELECT SUSER_SNAME(sid) AS UserName
FROM sys.database_principals
WHERE (type = 'U')

This view works exactly as I would expect for some users, but for others it does not show all of the users. I am guessing it's a permission problem somewhere. Any ideas as to what permission I need to set?

malpashaa
Constraint Violating Yak Guru

Saudi Arabia
264 Posts

Posted - 05/12/2010 :  16:03:58  Show Profile  Reply with Quote
For now I can think for two reasons that may cause this:
1- This system view is related to the database you are currently using. So assure that are in the correct database before running the query.
2- This system view is limited to what you (the user running the query) has been granted permission.
I think that it is the first reason. So check it first.

Edited by - malpashaa on 05/12/2010 16:04:28
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000