Script to get all logins and database user mappings

  • I need to collect all logins and user database mappings. I looked at master and found login names and default database mappings but I don't see what databases the login is a user in. What I would really like is to have a query that gives login name user databases it has access to and the database role.

    Is this possible?

    Thanks

  • Hi,

    Try with

    sp_helplogins

    sp_helpuser

  • Thanks, I forgot about these.

  • It's my pleasure 😉

  • Hi, I have written some SQL in the past that might just give you what you are looking for this will outout to a file in C:\temp called Security_Report.txt.

    File is attahced. Rename to .sql before running it.

    MCITP SQL 2005, MCSA SQL 2012

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

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