Get list of DBO''S in database

  • Hello all,

    I NEED To get  list of users that are granted dbo access in a given database/intance of sql server.  Anyone know of a script I can run to get a list of users with dbo rights?  Or another way to get them?

     

    Thanks,

     

    Jim Webster

  • Hope this will help

    sp_MShasdbaccess

  • In the database itself:

    EXEC sp_helprolemember 'db_owner'

    And since sysadmin fixed server role members also have map in as dbo:

    EXEC sp_helpsrvrolemember sysadmin

    K. Brian Kelley
    @kbriankelley

  • I am using sp_helprolemember 'db_owner'  to get the list of DBO role members in a given database.

    Some of these members in DBO role are Domain groups or local groups. How can I figure out (programatically), if these members in db_owner role are groups or not? Is there a table/view/stored proc out there to give us this info?

    Thanks

    Prasad

    P.S. If I can identify groups, then I can write a VB script to get all the logins with in these groups by reading it from Active directory. But the bottle neck is identifying which one groups and which one are not.

  • Map the user back up to a login by the SID. Then take a look at xp_loginfo. One of the columns tells you if it's a user or group.

    You can also just query against syslogins (SQL Server 2000). There are two columns of interest: isntgroup and isntuser. The first, obviously corresponds to Windows groups. The second to Windows users.

    K. Brian Kelley
    @kbriankelley

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply