Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Script to get list of databases for which a user has db_owner database role ? Expand / Collapse
Author
Message
Posted Wednesday, November 21, 2012 3:52 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, July 25, 2014 2:47 PM
Points: 587, Visits: 1,998
What is the command to get list of databases for which a user has db_owner database role ?
Post #1387642
Posted Thursday, November 22, 2012 1:47 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 8:53 AM
Points: 5,218, Visits: 5,072
You would need to loop through every database quering sys.database_role_members and sys.database_principals.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1387754
Posted Thursday, November 22, 2012 2:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 26, 2013 1:19 AM
Points: 8, Visits: 71
Thanks for your immediate replay..

As i am oracle dba,not no much about pt in sql server 2008..

Pls elobrat your answer so it will help me lot .

Regards,
Post #1387789
Posted Thursday, November 22, 2012 2:59 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, November 28, 2013 10:20 PM
Points: 45, Visits: 309
I also wanted something similar recently and used this article to get the list!

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=172689

You may want to set a filter in the at the end as: loginname='<required user>'

Hope this helps!
Post #1387796
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse