{"id":33,"date":"2011-04-20T13:54:06","date_gmt":"2011-04-20T13:54:06","guid":{"rendered":"http:\/\/devopsny.com\/blog\/?p=33"},"modified":"2013-03-04T20:53:56","modified_gmt":"2013-03-04T20:53:56","slug":"how-to-determine-database-role-permissions","status":"publish","type":"post","link":"https:\/\/devopsny.com\/blog\/2011\/04\/20\/how-to-determine-database-role-permissions\/","title":{"rendered":"How to Determine Database Role Permissions"},"content":{"rendered":"<p><span style=\"font-family: Calibri;\">This SQL statement will show all the permissions of a particular role:<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">use YourDBName<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">go<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">\u00a0<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">select dp.NAME AS principal_name,dp.type_desc AS principal_type_desc,<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">o.NAME AS object_name,p.permission_name,p.state_desc AS permission_state_desc <\/span><\/p>\n<p><span style=\"font-family: Calibri;\">from sys.database_permissions p<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">left OUTER JOIN sys.all_objects o<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">on p.major_id = o.OBJECT_ID<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">inner JOIN sys.database_principals dp<\/span><\/p>\n<p><span style=\"font-family: Calibri;\">on p.grantee_principal_id = dp.principal_id<\/span><\/p>\n<p>where dp.NAME=&#8217;YourDBRoleName&#8217;<\/p>\n<p>&nbsp;<\/p>\n<p>Thanks to Mike Warner<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This SQL statement will show all the permissions of a particular role: use YourDBName go \u00a0 select dp.NAME AS principal_name,dp.type_desc AS principal_type_desc, o.NAME AS object_name,p.permission_name,p.state_desc AS permission_state_desc from sys.database_permissions p left OUTER JOIN sys.all_objects o on p.major_id = o.OBJECT_ID inner JOIN sys.database_principals dp on p.grantee_principal_id = dp.principal_id where dp.NAME=&#8217;YourDBRoleName&#8217; &nbsp; Thanks to Mike Warner<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[35],"tags":[36],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-ms-sql-server","tag-mssql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3fcrv-x","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":2,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":35,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions\/35"}],"wp:attachment":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}