Skip to content

Instantly share code, notes, and snippets.

@radleta
Created March 27, 2020 13:57
Show Gist options
  • Save radleta/228cbdea35e4802ed87676ec7d1adb57 to your computer and use it in GitHub Desktop.
Save radleta/228cbdea35e4802ed87676ec7d1adb57 to your computer and use it in GitHub Desktop.
List all the groups and permissions assigned to a user in SQL Server.
select
[principal_id]
, [name]
, [type_desc]
, is_member(name) as [is_member]
from [sys].[server_principals]
where [type] in ('R','G')
order by [is_member] desc,[type],[name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment