I ran into a situation where It required me to transfer several
securable for a particular user from PROD to a UAT environment. I
was surprised to find there wasn't any easy way to do this through a GUI.
SELECT DP.State_desc + ' ' + DP.permission_name +
' ON ' + object_name(DP.major_id) +
' TO ' + '['+SU.Name COLLATE DATABASE_DEFAULT +']'
FROM sys.database_permissions
DP
JOIN sys.sysusers SU ON SU.UID = DP.grantee_principal_id
WHERE SU.Name = ''
order by
object_name(DP.major_id)
Comments
Post a Comment