SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


display permissions with database name


display permissions with database name

Author
Message
ColeTrain
ColeTrain
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 197
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 MemberName MemberSID
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,
ColeTrain
ColeTrain
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 197
I"m able to get the results with:

sp_msforeachdb @command1= "USE ? select '?' EXEC ?.dbo.sp_helprolemember db_owner"
lokhande.deepali
lokhande.deepali
Valued Member
Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)

Group: General Forum Members
Points: 69 Visits: 483
Try Below Query..


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


Rd,
Deepali
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search