Last active
January 4, 2021 10:41
-
-
Save alaawahbah/048612b3331eb5bf901cd7942d838b8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.Name as PermissionName, (STUFF( (select ',' + r.Name from Roles r where r.id in (select RoleId from RolePermissions rp where rp.RoleId =r.Id and rp.PermissionId = p.Id ) | |
FOR XML PATH('')), | |
1, 1, '')) AS RoleName | |
FROM Permissions p | |
------------------------------------------------- | |
DECLARE @CodeNameString varchar(100) | |
SELECT | |
@CodeNameString = STUFF( (select ',' + r.Name from Roles r where r.id in (select RoleId from RolePermissions rp where rp.RoleId =r.Id and rp.PermissionId = p.Id ) | |
FOR XML PATH('')), | |
1, 1, '') | |
print @CodeNameString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment