on 06-03-2015 3:08 PM
You may use the following query:
SELECT a.name as 'db_user', c.name as 'db_role', a.default_schema_name
FROM sys.database_principals a
LEFT JOIN (sys.database_role_members b
JOIN sys.database_principals c ON b.role_principal_id = c.principal_id) ON b.member_principal_id = a.principal_id
LEFT JOIN sys.server_principals d on a.sid = d.sid
WHERE a.type<> 'R';
You can play around with with the query removing any field in the select part of the statement.
Regards,
Luis Darui
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Moshe-Eliashar,
You can use "sp_helpuser" for this, or "select * from sys.database_principals". Have a look at sp_helpuser (Transact-SQL).
Cheers,
Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.