RE: Generating scripts for existing permissions



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.

.



Relevant Pages

  • RE: GridView RowEditing Requery question
    ... Gridview is always retrieved from database directly? ... the calling side always get the cached resultset. ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: GridView RowEditing Requery question
    ... Gridview is always retrieved from database directly? ... ** Implement local cache in your ASP.NET application(for the data access ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: query-based update failed
    ... Could you please clarify a bit more on what you mean by "checking each record in your recordset to see if it is in your database table at that time"? ... Look forward to your response. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sqlserver.odbc)
  • Re: VS2008 DBE (GDR)
    ... target database, which already has data in some lookup tables. ... Microsoft Online Community Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.vsnet.general)
  • Re: Search services not available
    ... If a content database is not associated with a search server and you ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sharepoint.windowsservices)

Loading