December 3, 2013 at 8:56 am
Hi
I need a script as part of a security audit. Any pointers would help.
Even a table name where this stored will do.
December 3, 2013 at 9:08 am
I'm not sure what you are asking with this question. If you want a table to list every principal on the server you can use sys.server_principals
December 3, 2013 at 10:10 am
I need to know who is in the DBO role for each database on my server.
Via a script.
December 3, 2013 at 10:37 am
Here is the query:
SELECT
USER_NAME(memberuid) as Member
,USER_NAME(groupuid) as [Group]
FROM
sys.sysmembers
WHERE
USER_NAME(groupuid) = 'db_owner'
and you can use sp_MSforeachdb to run it for all databases on your server.
December 4, 2013 at 3:02 am
Excellent. Nice one. Never used Sysmembers. Every day is a school day.
December 4, 2013 at 3:04 am
sys.sysmembers (Transact-SQL)
This SQL Server 2000 system table is included as a view for backward compatibility. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
The 2008 equivalent is sys.database_role_members.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply