List DB_Roles from Table

  • Are the roles in each individual DB stored in a table on each database? I know that you can get this information from sp_helprole.

    But, what I'm looking to run is grab logins from sysusers where name not in ..

    Thanks!

  • The roles are also in sysusers. Query on the IsAppRole or IsSQLRole columns.

    --------
    [font="Tahoma"]I love deadlines. I like the whooshing sound they make as they fly by. -Douglas Adams[/font]

  • What I need to do is grab users from sp_helpuser for the 'lgoinname' field. this is incorrect in sysusers as for some reason it drops the domain prefix.

  • If you're looking to get the login names and you're trying to filter based on just those names, here's what you need:

    SELECT sl.NAME

    FROM dbo.sysusers su

    JOIN master.dbo.syslogins sl

    ON su.sid = sl.sid

    Add the appropriate WHERE clause.

    K. Brian Kelley
    @kbriankelley

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

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