SQL Server Performance

TSQL to generate GRANT statements from a database

Discussion in 'Other SQL Server Blogs around the Web' started by Anonymous, Aug 17, 2007.

  1. Anonymous New Member

    select p . state_desc + ' ' + p . permission_name + ' OBJECT::' + s . name collate Latin1_general_CI_AS + o . name collate Latin1_general_CI_AS + ' TO ' + u . name collate Latin1_general_CI_AS + 'GO' , p .* from sys.database_permissions p inner join sys.objects o on p . major_id = o . object_id inner join sys.schemas s on s . schema_id = o . schema_id inner join sys.database_principals u on p . grantee_principal_id = u . principal_id The above script is useful when you want to GRANT access to set...(<a href="http://sqlserver-qa.net/blogs/t-sql/archive/2007/08/17/1544.aspx">read more</a>)<img src="http://sqlserver-qa.net/aggbug.aspx?PostID=1544" width="1" height="1">

Share This Page