HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

SQL server level permissions

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
sqllevelpermissionsserver

Problem

I am aware of the Microsoft provided code to transfer logins between SQL servers, however this only does the account and the password.

What if that particular account has various roles and permissions assigned to it at a server level, is there an equivalent piece of code to script these permissions also?

Thanks

Solution

I have not personally tried this, but have a look the the Idera Permission Extractor:

Free Tool SQL Permissions Extractor

If you need a sql solution, there is nothing built in. However, you can query the sys.server_permissions and sys.database_permissions tables. They contain the information needed to build the grant statements yourself. sys.server_role_members and sys.database_role_members contain the information needed to generate role membership scripts.

Context

StackExchange Database Administrators Q#47051, answer score: 5

Revisions (0)

No revisions yet.