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.
Author |
Topic |
Oliver wang
Yak Posting Veteran
50 Posts |
Posted - 2010-12-14 : 02:58:28
|
Hi everyone,Is there anybody know in sql server 2008, where i can find a system table containing information like which login account is the db_owner of which database(maybe there are more than one db_owner for a certain database). Does anyone has an idea on this? Thanks a lot.regards,Oliver |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-12-14 : 03:57:35
|
Do you want to know which login is the database owner, or which users are members of the db_owner role?--Gail ShawSQL Server MVP |
 |
|
Oliver wang
Yak Posting Veteran
50 Posts |
Posted - 2010-12-14 : 05:36:35
|
Hi Gail,Thanks for your reply. I want to know which users are members of the db_owner role of a certain database.regardsOliver |
 |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-12-14 : 07:10:02
|
select m.name from sys.database_principals r inner join sys.database_role_members rm on r.principal_id = rm.role_principal_id inner join sys.database_principals m on m.principal_id = rm.member_principal_id where r.name = 'db_owner'--Gail ShawSQL Server MVP |
 |
|
Oliver wang
Yak Posting Veteran
50 Posts |
Posted - 2010-12-15 : 01:46:31
|
Hi Gail,Your scripts works perfectly. Thank you very much.regards,Oliver |
 |
|
|
|
|