sql.How to find which tables and views a user has access to?

PHOTO EMBED

Thu Sep 30 2021 14:51:49 GMT+0000 (Coordinated Universal Time)

Saved by @rick_m #sql

 USE Your_Database;
 GO
 EXECUTE AS USER = N'the_user_name';
 GO
 SELECT 
    s.name,
    o.name,
    p.[permission_name]
 FROM sys.objects AS o 
 INNER JOIN sys.schemas AS s
 ON o.[schema_id] = s.[schema_id]
 CROSS APPLY sys.fn_my_permissions(QUOTENAME(s.name) 
   + N'.' + QUOTENAME(o.name), N'OBJECT') AS p
   WHERE o.[type] IN (N'U', N'V') -- tables and views
   AND p.subentity_name = N''; -- ignore column permissions 
 GO
 REVERT;
content_copyCOPY

https://dba.stackexchange.com/questions/41234/how-to-find-which-tables-and-views-a-user-has-access-to