Question : Get a list of users of a database.

For example, I have a database MyDatabase with 6 users A, B, C, D, E, F. This database is in a server that has 3 System Admins adminA, adminB, adminC. How can I get a table (return by select statement or SP) that has 2 columns Type, Name with rows are information about 6 users and 3 system admins. This is the table I want to have:
------------------------------------------------
Type                                     Name
User                                      A
User                                      B
User                                      C
User                                      D
User                                      E
User                                      F
Sysadmin                               adminA
Sysadmin                               adminB
Sysadmin                               adminC
-----------------------------------------------
I want to do that when I am a normal user (user A, for example) or a system admin (adminA, for example).
Thanks.

Answer : Get a list of users of a database.

    - 6 users of MyDatabase.
     - 3 system admins of MyServer.

ok, i guess you are speaking about LOGINS (on server level) and USERS (on database level)
how do you identity the "users" and the "sysadmin" ?

in sql server 2000, the logins are here:
select * from master.dbo.syslogins
in sql server 2005:
select * from master.sys.logins

the users are found in SQL 2000 (per current database):
select * from dbo.sysusers
in SQL 2005:
select * from sys.users


Random Solutions  
 
programming4us programming4us