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 2008 Forums
 SQL Server Administration (2008)
 system table which contains db_owner info

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 Shaw
SQL Server MVP
Go to Top of Page

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.

regards

Oliver
Go to Top of Page

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 Shaw
SQL Server MVP
Go to Top of Page

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
Go to Top of Page
   

- Advertisement -