Re: How do I script out all the permmisions granted to a database role
- From: "Uri Dimant" <urid@xxxxxxxxxxx>
- Date: Tue, 16 Jan 2007 07:39:17 +0200
Tony
Aaron wrote this script
CREATE FUNCTION dbo.RoleCheckUser
(
@UserName sysname,
@RoleName sysname
)
RETURNS BIT
AS
BEGIN
DECLARE @RetVal BIT
SET @RetVal = 0
SELECT @RetVal = 1
WHERE EXISTS
(
SELECT *
FROM sysmembers membs
JOIN sysusers users on membs.memberuid = users.uid
JOIN sysusers groups on membs.groupuid = groups.uid
WHERE
users.name = @UserName
AND groups.name = @RoleName
)
RETURN @RetVal
END
GO
-- Syntax to use the created function
SELECT dbo.RoleCheckUser('dbo', 'db_owner')
GO
"Tony C" <TonyC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FA1B80AC-34C2-49EE-9C72-84775408565D@xxxxxxxxxxxxxxxx
How do I script out all the permmisions granted to a database role. When
moving database roles to my production environment I need clean way to
script
out all securables (tables, views and procedures, etc...) and the rights
granted to them for this role. Logins assigned to the role would be
helpful
also. I don't see a way to script these out or report on them. Is there
a
way to do this? I am familiar with listing the properties for the role,
and
listing the explicit permissions on the securable tab within manangement
studio. But this is very manual. If I script out the database role by
right
clicking it, I only get the create role statement with none of the object
rights or logins granted to this role.
Thanks
Tony
.
- Prev by Date: Re: Cannot view DB properties
- Next by Date: Re: Cannot view DB properties
- Previous by thread: Re: Cannot view DB properties
- Next by thread: Re: DBO Schema
- Index(es):
Relevant Pages
|