Exportar privilegios

use MyDataBase

GO

SELECT T1.state_desc
    , T1.permission_name
    , 'ON'
    , '[' + OBJECT_SCHEMA_NAME(T1.major_id) + '].[' + OBJECT_NAME(T1.major_id) + ']'
    , 'TO'
    , USER_NAME(T1.grantee_principal_id)
FROM sys.database_permissions T1
JOIN sys.database_principals T2 ON T2.principal_id = T1.grantee_principal_id
WHERE T1.class_desc = 'OBJECT_OR_COLUMN'
ORDER BY 2, 6, 4