SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,356 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello, what is the script to get list of all objects (Tables, Views, Stored Procedures, etc...) that's within a particular user created Role?
Thanks in advance.
You can try this.
SELECT o.name AS ObjectName, o.type_desc AS ObjectType
FROM sys.database_permissions p INNER JOIN sys.database_principals r
ON p.grantee_principal_id = r.principal_id INNER JOIN sys.objects o
ON p.major_id = o.object_id WHERE r.name = 'RoleName'
ORDER BY o.name, o.type_desc;
Best regards,
Percy Tang