display permissions with database name

  • Hello,

    I am running the following:

    sp_msforeachdb @command1= "PRINT '?' EXEC ?.dbo.sp_helprolemember db_owner"

    this is providing me the correct results but I am unable to get it to display the database name with the result set?

    I would like to have something showing the Database name above then the permissions below each name for each result.

    DatabaseName

    DbRole MemberNameMemberSID

    db_owner dbo 0x01

    My issue is I need to generate a report for Auditing that shows every DB with each user that has DBO rights to that DB. If I can get that in a single report that would be even better.

    Thanks,

  • I"m able to get the results with:

    sp_msforeachdb @command1= "USE ? select '?' EXEC ?.dbo.sp_helprolemember db_owner"

  • Try Below Query..

    sp_msforeachdb @command1= "select '?' as Databasename EXEC ?.dbo.sp_helprolemember db_owner"

    Rd,

    Deepali

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

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