RE: Generating scripts for existing permissions
- From: petery@xxxxxxxxxxxxxxxxxxxx ("Peter Yang[MSFT]")
- Date: Fri, 26 Oct 2007 06:35:18 GMT
Hello,
As I know there is no simple method to generate the scripts to grant
permission to roles. You could use the query like following to get the all
permissions of roles:
SELECT users.name, object_name(perms.major_id) object,
permission_name, state_desc
FROM sys.database_permissions as perms
inner join sys.database_principals as users
on perms.grantee_principal_id = users.principal_id
WHERE perms.class = 1
and users.type='R'
You may need to develop some code to parse the result to generate the
script to "grant" the permissions to the roles.
Also, I'd like to know why you want to reconstruct the roles from one
database to another? Usually backup/restore, detach/attch database might be
the most efficient method to migrate database.
If both database have the exact same schema but with different data, you
could use SSIS or import/export wizard to copy data directly.
If you have any comments or questions, please feel free to let's know.
Thank you.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
<http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscriptions/support/default.aspx>.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Prev by Date: Accessing DB from windows service
- Next by Date: database owner
- Previous by thread: Accessing DB from windows service
- Next by thread: database owner
- Index(es):
Relevant Pages
|
Loading