Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Permission scripting over all databases

By W Louw,

This stored procedure is helpful in scripting permissions for a user in all databases it exist in.

If @newuidname has a value of '', it will scroll all databases and search for its permissions.

If @newuidname has a valid username, it will only script out the permissions for @uidname where @newuidname does not already have the same permissions or roles assigned.

If @RolePermissions = 1 the permissions of the roles @uidname belong to will also be scripted.

I initially used sp_helprotect, but then I had to do it database by database individually, this way I can run it once for all. This sp can be compiled on any database and it will still go through all databases.

Hope it is useful.

Telammica

Total article views: 13693 | Views in the last 30 days: 44
 
Related Articles
FORUM

scripting a database without db owner permissions

scripting a database without db owner permissions

FORUM

Scripting Objects Including Permissions

Scripting Objects Including Permissions

FORUM

Versioning database release and permission scripts

How do you version permission scripts

SCRIPT

Retrieve Database Object permission scripts and Role members scripts

I often need to synchronize the user permission between databases. I wrote this simple query to scri...

BLOG

A Script A Day - Day 11 - User Permissions By Database

Today's script will return you permissions granted to a user for every online database.  The script ...

Tags
administration    
databases    
grant    
logins    
permissions    
role    
script    
scripting    
security    
sql server 7    
t-sql    
user    
 
Contribute